Push Notifications Server Migration Guide

Use the new Pusher Beams Server SDKs to publish notifications.

Create and Configure Beams instance

In order to complete this migration you will need a Pusher Beams Instance ID and Secret Key.

If you haven’t already, head on over to the New Dashboard and create a new Pusher Beams instance, noting down your Instance ID and Secret Key.

Integrate the Pusher Beams Server SDK

When you release the new version of your app that contains the Pusher Beams SDK, some of your users will take some time to upgrade.

As a temporary migration step, your server should publish to both Pusher Beams and the old push notifications [BETA] feature until you are happy that enough users have upgraded. We have created an automated migration process on the backend to ensure no duplicate notifications will be delivered. The Pusher Beams client SDKs will automatically migrate each device’s Interest subscriptions and remove them from push notifications [BETA].

func sendPushNotification(pushNotifications pusher.Client, beams pushnotifications.PushNotifications, fcmPayload interface{}) error {
    // Push Notifications BETA:
    err1 := pushNotifications.Notify(pusher.PushNotification{
        Interests: []string{"hello"},
        FCM: fcmPayload,
    })

    // Pusher Beams:
    publishRequest := map[string]interface{}{
        "fcm": fcmPayload,
    }

    _, err2 := beams.Publish([]string{"hello"}, publishRequest)
    if err1 != nil {
        return err1
    }
    if err2 != nil {
        return err2
    }

    return nil
}
function sendPushNotification(pushNotifications, beams, payload) {
  // Push Notifications BETA:
  pushNotifications.notify(["hello"], payload, function(error, req, res) {
    console.log(error, req, res);
  })

  // Pusher Beams:
  beams.publish(['hello'], payload).then((publishResponse) => {
    console.log('Just published:', publishResponse.publishId);
  }).catch((error) => {
    console.log('Error:', error);
  });
}
function sendPushNotification($pushNotifications, $beams, $payload) {
  // Push Notifications BETA:
  $pushNotifications->notify(array("hello"), $payload);

  // Pusher Beams:
  $beams->publish(array("hello"), $payload);
}
def sendPushNotification(pushNotifications, beams, payload):
  // Push Notifications BETA:
  pushNotifications.notify(["hello"], payload)

  // Pusher Beams:
  beams.publish(interests=['hello'], publish_body=payload)
def send_push_notification(pushNotifications, beams, payload)
  # Push Notifications BETA:
  pushNotifications.notify(["hello"], payload)

  # Pusher Beams:
  beams.publish(interests: ['hello'], payload: payload)
end

If you’re using the webhooks feature, please note that we have changed the API a bit, so please read Webhooks reference.

If you have implemented the integration without the use of an SDK, see read the API reference to learn how to publish.
The major differences are the endpoint path and the authentication method (token bearer auth). The request body is still the same.

Have you tried using the search to find what you’re after? If you still have a question then get in touch with us and let us help you out.