Skip to content

Integrating ContextSDK Push Notifications with OneSignal Journeys

This guide provides step-by-step instructions on how to configure OneSignal's Journeys feature to send push notifications using a webhook to interact with the ContextSDK API.

Step 1: Add a Webhook Action to the Journey

  1. Go to the Journey you want to leverage context-aware push notifications.
  2. Add a new action within your journey by selecting "Add Action" and then choose "Send Webhook."
  3. Configure the webhook with the following details:

    • URL: https://push.contextsdk.com/v1/campaigns/schedule_message_for_user
    • Request Type: POST

Step 2: Set Up Request Headers

In the webhook configuration, include the necessary headers to authenticate the request:

  • Authorization: Bearer [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:

{
  "bundle_id": "com.contextsdk.demo",
  "platform": "ios",
  "user_id": "{{email}}",
  "content": {
    "title": "It's time to get started with crypto",
    "body": "Just upload your ID, and start trading now"
  },
  "deliver_within_hours": 6,
  "campaign_id": "daily-reminder",
  "delivery_method": "context_aware"
}

Notes:

  • Replace {{email}} with the appropriate OneSignal variable for the user ID. This example assumes the email is used as the user ID.
  • Adjust the title and body fields to match your campaign's messaging.