CleverTap / clevertap-web-sdk

CleverTap Web SDK
https://clevertap.com/
MIT License
14 stars 17 forks source link

Webpush issue, #118

Open aliaburas80 opened 1 year ago

aliaburas80 commented 1 year ago

When I try to do a web push using a simple example for the documentation I get the below error

CleverTap [1678351307444]: Ensure that web push notifications are fully enabled and integrated before requesting them Before I can use the example and got the push over Chrom, FireFox and Safari, now I only get the error!


    <script type="text/javascript">
        var clevertap = {event:[], profile:[], account:[], onUserLogin:[], notifications:[], privacy:[]};
    // replace with the CLEVERTAP_ACCOUNT_ID with the actual ACCOUNT ID value from your Dashboard -> Settings page
   clevertap.account.push({"id": "XXXXXXXXXXXXXX"});
   clevertap.privacy.push({optOut: false}); //set the flag to true, if the user of the device opts out of sharing their data
   clevertap.privacy.push({useIP: false}); //set the flag to true, if the user agrees to share their IP data
    (function () {
            var wzrk = document.createElement('script');
            wzrk.type = 'text/javascript';
            wzrk.async = true;
            wzrk.src = 'https://d2r1yp2w7bby2u.cloudfront.net/js/clevertap.min.js';
            var s = document.getElementsByTagName('script')[0];
            s.parentNode.insertBefore(wzrk, s);
     })();
   </script>

    <script>
      const doPushNotification = () => {
          const clevertap = window.clevertap;

          let customNotificationPayload = {
            msgId: "111111111111111",
          };

          clevertap.notifications.push({
            titleText: "Would you like to receive Push Notifications?",
            bodyText:
              "We promise to only send you relevant content and give you updates on your transactions",
            okButtonText: "Sign me up!",
            rejectButtonText: "No thanks",
            okButtonColor: "#F28046",
            skipDialog: true,
          });
        }
      };

      doPushNotification();
    </script>
KambleSonam commented 1 year ago

@aliaburas80 Can you share the test app link which can help us to reproduce the issue ?

KambleSonam commented 1 year ago

@aliaburas80 Were you able to solve the issue mentioned? Kindly confirm.