How to send dry run notifications with vapid push notifications

1.8k views Asked by At

GCM provides a way to send dry run messages to test the request formats, as explain in reference https://developers.google.com/cloud-messaging/http-server-ref. How can the similar dry_run support be achieved with VAPID (FCM) standard?

1

There are 1 answers

0
Paschoali On

I know this is an old post, but I'll answer. Maybe it helps someone.

You can use DryRun to test in FCM too. Look:

// Send a message in the dry run mode.
var dryRun = true;
admin.messaging().send(message, dryRun)
  .then((response) => {
    // Response is a message ID string.
    console.log('Dry run successful:', response);
  })
  .catch((error) => {
    console.log('Error during dry run:', error);
  });

You need to pass a bool as second parameter of send() function.