braze-inc / braze-web-sdk

Public repo for the Braze Web SDK
https://www.braze.com
Other
73 stars 25 forks source link

Safari: Soft Push Notification #72

Closed miriam30 closed 4 years ago

miriam30 commented 4 years ago

Hi, I'm currently trying to get Push Notifications to work in Safari... I have already added the soft push configuration according to your documentation, and am able to view the notification but when when I click "Accept" no push registration is done. Safari certificate is up to date and service worker has been added also according to documentation

Version used: 2.4.3

appboy.subscribeToNewInAppMessages(function(inAppMessages) {
    var message = inAppMessages[0];
    var shouldDisplayMessage = true;

    if (message != null && message instanceof appboy.ab.InAppMessage) {
        var msgId = message.extras["msg_id"];

        if (msgId == "push-primer") {
          // Prompt the user when the first button is clicked
          message.buttons[0].subscribeToClickedEvent(function() {
              window.appboy.registerAppboyPushMessages(function() {
                console.info("User successfully registered!");
                window.appboy.logCustomEvent("optin_web_push");
                window.appboy.requestImmediateDataFlush();
              }, function() {
                console.info("User has did not register");
              });
          });
        }
    }
    // Display the message
      shouldDisplayMessage && appboy.display.showInAppMessage(message);
    return inAppMessages.slice(1);
})
Screen Shot 2020-01-15 at 18 08 21
froodian commented 4 years ago

Hi @miriam30 - thanks for reaching out, Safari push configuration can be particularly finicky to get fully set up. When registerAppboyPushMessages is being called but you're not getting the permissions prompt from the browser, things to check include:

Another helpful debugging step can potentially be to supply the enableLogging option to appboy.initialize which will provide some additional data to the console. If you're still having trouble, if you open a case with our support team they should be able to examine the specifics of your integration and get you up and running.