Web Push Notifications

Push Notification is a Web SDK feature you could enable to bring the power of BirdCRM in building connected user experience to your website.

Push notification functionality is implemented according to the HTTP Push RFC8030 standard, which is supported by all modern web browsers, including the latest version of Safari.

Integrating Push Notifications with Bird Web SDK into your website consists of the following steps:

  • Add <script> tag associated with your Bird Application by the data-config-url at your website:

    <script
      src="https://embeddables.p.mbirdcdn.net/sdk/v0/bird-sdk.js"
      data-config-url="{applications_key_url}"
    ></script>
  • Add /service-worker.js file with the following content:

    importScripts('https://embeddables.p.mbirdcdn.net/sdk/v0/bird-push-sw.js');

It must be hosted at your website domain like https://yourwebsite.domain/service-worker.js

Note: you also could set another filename in the Bird Applications setting if you need to.

  • Once Bird SDK init we can subscribe to Push Notifications by Bird.pushNotifications.subscribe()

You must have your users interact with your site before you are allowed to ask for notification permissions.

  • Add the subscribe call for example with a button click:

    subscribeButton.addEventListener('click', async () => {
      await Bird.pushNotifications.subscribe();
    });

Last updated