Skip to main content
Integrating with OneSignal

How to send emails and messages from Coho AI using OneSignal

Updated over a month ago

Prerequisites

You can use the OneSignal API to send emails and other messages to your users. To do so, you need to gather the following information:

  1. OneSignal API Key
    For added security, when creating a key, add the following addresses to the IP allow list:

    • 34.76.99.39

    • 34.78.60.61

    • 34.79.38.46

    • 35.195.102.66

Example: Sending an email using a template

To send an email using a template, you will need the Template ID form OneSignal. Once you have that, do the following steps:

  1. In Coho AI, edit the Playbook you want to send the email from.

  2. Create a new HTTP Action.

  3. Fill in the following details (reference):

    • Method: POST

    • URL: https://api.onesignal.com/notifications

    • Headers:

      {
      "Authorization": "Key YOUR_API_KEY",
      "Accept": "application/json",
      "Content-Type": "application/json"
      }
    • JSON Payload:

      {
      "app_id": "YOUR_APP_ID",
      "target_channel": "email",
      "email_subject": "Welcome to Cat Facts!",
      "template_id": "YOUR_TEMPLATE_ID",
      "include_aliases": {
      "external_id": [ "{{userId}}" ]
      }
      }

Did this answer your question?