OneSignal
Learn how to integrate ContextPush with OneSignal.
Integrating ContextSDK Push Notifications with OneSignal Journeys
This guide provides step-by-step instructions on how to configure OneSignal's Journeys to send push notifications using a webhook to interact with the ContextPush API.
Step 1: Add a Webhook Action to the Journey
Go to the Journey you want to leverage context-aware push notifications.
Add a new action within your journey by selecting "Add Action" and then choose "Send Webhook."
Configure the webhook with the following details:
URL:
https://push.contextsdk.com/v1/campaigns/schedule_message_for_userRequest Type:
POST
Step 2: Set Up Request Headers
In the webhook configuration, include the necessary headers to authenticate the request:
Authorization:
Token [Your_Token]Content-Type:
application/json

Step 3: Define the Request Body
Configure the webhook payload using OneSignal's templating to dynamically include user-specific data. Use the following JSON structure:
Notes:
Replace
{{ user.external_id }}with the appropriate OneSignal variable for the user ID.Adjust the
titleandbodyfields to match your campaign's messaging.
Using the Key/Value Pairs Body
If you prefer configuring your payload purely through the OneSignal UI we have a special endpoint that is compatible with a non nested JSON body. Instead of https://push.contextsdk.com/v1/campaigns/schedule_message_for_user use the https://push.contextsdk.com/v1/campaigns/schedule_message_for_user_flattened endpoint. This allows you to replace all nested values with keys in the format of content/title, content/body, etc.
This way you can fully configure ContextPush using only Key/Value pairs.

Localization
You can use the built-in Liquid syntax to directly supply the localized string when scehduling a message. The below example uses the https://push.contextsdk.com/v1/campaigns/schedule_message_for_user_flattened endpoint:
Last updated
Was this helpful?