Push Test

LAST EDIT May 27 2022

Once you're all setup with push notifications, you can use the CLI to test how the these notifications will look for your devices.

In preparation of this make sure that:

  • Your app has push notifications configured for at least one provider in your app settings

  • You have a user that has at least one device associated

    • To skip sending to devices but only to see the payload, pass skip_devices=true

The base command for testing push notifications is:

This will do several things for you:

  1. Pick a random message from a channel that this user is part of

  2. Use the notification templates configured for your push providers to render the payload using this message

  3. Send this payload to all of the user's devices

This particular use case is ideal for testing a newly configured app, to make sure the push notifications are exactly as wanted.

In some other cases, your app is already configured with push notifications and is running smoothly, but you want to try out a new notification template. For example, let's say you want to test a new APN notification template:

As you can see, this one time only, the new template will be used for the push notification instead of the configured one:

Here's a full list of parameters that you can use with the test command:

Push Test Parameters

Copied!
nametypedescriptiondefaultoptional
user_idstringThe user ID-
message_idstringID of the message that should be used instead of a random one. If the message doesn't exist, an error will occur-
apn_notification_templatestringNotification template to be used instead of the configured APN one. This is one time only. (v1 only)-
firebase_notification_templatestringNotification template to be used instead of the configured APN one. This is one time only. (v1 only)-
firebase_data_templatestringData template to be used instead of the configured Firebase one. This is one time only. (v1 only)-
skip_devicesbooleanSkip requiring device tokens and sending.False

Push Test Payload

Copied!

nametypedescriptiondefaultoptional
device_errorsobjectA map of errors indexed by device tokens.-
general_errorsarray of stringsA list of errors encountered with providers.-
skip_devicesbooleanGiven skip_devices flag is passed back.-
rendered_apn_templatestringYour executed APN template (v1 only).-
rendered_firebase_templatestringYour executed Firebase template (v1 only).-
rendered_messagestringYour payload (v2 for all providers and v1 for Huawei/Xiaomi)-