Step 1. Setup

  1. If you do not have an account with OneSignal yet, you can quickly get onboarded by following their guide.
  2. Once your account is setup, you need to integrate OneSignal on your client side. Please follow the guide if you haven’t setup the OneSignal SDK yet.
    • Mobile (Android, iOS, React Native, Flutter etc).
    • Web

Step 2. OneSignal Integration in Raven

KeysDetails
OneSignal App IDPublic Key used for initialisation and app identification. More details here.
API KeyPrivate key used for most API calls. More details here.

Step 3. Managing Tokens

OneSignal automatically creates an identifier per device which is a unique OneSignal User ID aka player_id. The external_user_id is an identifier you set, which helps map your unique database User ID’s to the OneSignal player_id device record. This could be any unique identifier even an email or mobile. More details on OneSignal user subscription here.

Step 4. Sending Notifications

Raven currently supports sending OneSignal push notifications only via the external_user_id. This means you will have to set this via the OneSignal SDK or their API. You can then send the external_user_id as onesignal_external_id in the user object of Send Event API when triggering a notification. Please check our Send Event API docs for more details.

Here’s how you should pass onesignal external id in user object in Send Event API:

User Object
{
  "user": {
    "onesignal_external_id": "<your_onesignal_external_id>"
  }
}

Step 5. Notification Rendering

Notification rendering is handled by the OneSignal SDK or by you. If you choose to render the notifications yourself, you can check OneSignal’s event handler doc (mobile & web) for more details.

Step 6. Delivery Reports

Delivery reports need to be setup using the Raven Client SDK. You can integrate the Raven Client SDK and use the updateStatus method to send the notification status to Raven server. Please refer to our Client SDK section for more details.

Advanced

Send additional parameters to OneSignal

Raven will send the fields present in the Push template to OneSignal by default. Check our Push Template section to see which fields are sent to OneSignal. Also, you can send other additional parameters directly to OneSignal in the Send Event API as shown below.

"override" : {
    "providers" : {
       "<ONESIGNAL_INTEGRATION_NAME>": {   //integration name
           payload: {
               "<key>": "<value>" //key-values to be passed
               ...
           }
       }
    }
 }

Check our Send Event API doc for the complete request.

If you are facing issues with this integration or find something missing, please write to us at support@ravenapp.dev.