Use the OneSignal integration with ActiveCampaign to send push notifications to the web, mobile devices, and apps, and receive OneSignal events to ActiveCampaign whenever an event occurs. Doing so lets you send direct and immediate communication to current and potential customers, drive engagement rates, re-engage inactive users, personalize customer experiences, and is a cost-effective addition to your marketing strategy.
This article explains how to connect OneSignal to ActiveCampaign to send push notifications and sync OneSignal events to ActiveCampaign.
Take note
- The following is required to set up the integration:
- ActiveCampaign account with automation permissions
- OneSignal account set up and configured to send push notifications
- Set up and configure the web app in OneSignal
- Push notification templates (if using) in OneSignal. Platforms supported include:
- Apple iOS (APNs)
- Google Android (FCM)
- Web
- OneSignal User auth key
- OneSignal Rest API key for each web app
- OneSignal External ID field for each Subscription record populated with the unique identifier for ActiveCampaign (email address)
- Email addresses captured through an ActiveCampaign form will automatically populate the OneSignal External ID field
- Note: Please contact your web or mobile app developer to configure a path to push the email address of an ActiveCampaign contact to the OneSignal External ID
- Note: OneSignal does not push the email address captured from the email or phone prompt within the Permission Prompt Setup
- For web push notifications, OneSignal stopped supporting new apps from using Blogger, Squarespace, Webflow, Weebly, Wix, HTTP sites, and website builders that don't support uploading Service Workers to a server (which are required for web push). Learn more here
- Wix Studio customers - Please review this article about uploading OneSignal's service worker file to your root directory
Watch a video
How the integration works
This integration offers two separate sync options. One syncs data to your ActiveCampaign account, and the other sends push notifications via automation. You can choose to use either one or both options. However, they function separately.
Syncing OneSignal Event Streams to ActiveCampaign
Once configured, Event Streams will sync to ActiveCampaign whenever an event occurs. This is sent via a webhook.
Sending push notifications
To send push notifications, you can configure the integration through one of two automation actions: You can use either of the automation actions, or both, to send push notifications:
- “OneSignal - Assign a tag” action - this action lets you send mobile in-app push notifications
- “OneSignal - Send push notification” action - this action enables you to send web and mobile push notifications
Reporting
You can find reporting for this integration in your OneSignal account. You can also use ActiveCampaign to create an advanced search of all contacts who entered your OneSignal automation.
Sync OneSignal event streams to ActiveCampaign
This sync sends events from OneSignal to ActiveCampaign whenever an event occurs.
What to expect
The integration setup takes place in both your ActiveCampaign and OneSignal accounts. We will provide you with JSON code to implement into your OneSignal account. Once complete, this integration will create new and update existing contact records in ActiveCampaign and sync the appropriate event data.
Please note that our Customer Experience team cannot assist you with troubleshooting or implementing code on your behalf.
Supported events
The following events are supported:
- In-App Impression
- In-App Clicked
- In-App Page Displayed
- Push Sent
- Push Received
- Push Clicked
- Push Failed
- Push Unsubscribed
OneSignal data on contact records
A custom object record is created for each contact. This custom object includes the following data:
- External ID
- Timestamp
- Event ID
- Event Type
- Message ID
- Message Name
- Message Title
- Message Contents
- Subscription Device Type
Step-by-step instructions
ActiveCampaign configuration:
- From your ActiveCampaign account, click your profile > Apps.
- Use the search bar to locate the OneSignal integration.
- Click the “Add an account” button.
-
A modal window will appear. Enter the User Auth Key from your OneSignal account and click the “Connect” button.
If you’ve already configured the OneSignal integration via an automation action, you can select your existing connection on this screen.
-
Map the incoming OneSignal fields to the desired fields in ActiveCampaign, then click “Finish.”
- Required: You must map the OneSignal “External ID” field to the ActiveCampaign “Contact email” field for the integration to work correctly. If you do not, the sync will fail
- Click the arrow next to the “Edit” button for your created resource, then click “Copy Webhook URL.” Keep this value on your clipboard or paste it somewhere for future reference, as it is required for the OneSignal configuration.
OneSignal configuration:
- Log in to your OneSignal account, select “All Apps,” and choose the app you wish to connect.
- Click “Event Streams” from the “Data” menu.
- Click “New Event Stream.”
- Name the Event Stream as desired and click “Select Events.” In the pop-up modal, select all events in the “In-App Message” and “Push Notification” sections and click “Done.”
- Paste the Webhook URL you copied in the last step of the ActiveCampaign configuration into the URL field.
- In the Headers section, add an entry with a key of “Content-Type” and a value of “application/json.”
-
In the Body section, select “Custom Body” from the dropdown menu. Replace the contents of the section with the following JSON:
{
"event.kind": "{{ event.kind }}",
"event.id": "{{ event.id }}",
"event.timestamp": "{{ event.timestamp }}",
"event.datetime": "{{ event.datetime }}",
"event.app_id": "{{ event.app_id }}",
"event.subscription_device_type": "{{ event.subscription_device_type }}",
"event.subscription_id": "{{ event.subscription_id }}",
"event.onesignal_id": "{{ event.onesignal_id }}",
"event.external_id": "{{ event.external_id }}",
"message.id": "{{ message.id }}",
"message.name": "{{ message.name }}",
"message.title": "{{ message.title.en }}",
"message.contents": "{{ message.contents.en }}",
"template_id": "{{ message.template_id }}",
"message.template_id": "{{ message.template_id }}",
"message.url": "{{ message.url }}",
"message.app_url": "{{ message.app_url }}",
"message.web_url": "{{ message.web_url }}"
}The JSON code above must be copied exactly as is; otherwise, the integration will not function properly.
- Click “Activate” to save and enable the Event Stream.
Connect OneSignal to ActiveCampaign with the “OneSignal - Assign a tag” automation action
This automation action lets you create segments in OneSignal. Once the segment is defined, you can send in-app notifications directly from OneSignal for your mobile app. ActiveCampaign cannot directly send in-app push notifications from automations.
What to expect
This setup has three main steps:
- Create a segment in OneSignal using the “UserTags” filter for the key/value pair you will use when configuring the automation action.
- Configure the push notification in OneSignal for mobile apps.
- Add the “OneSignal - Assign a tag” action to your automation. In this step, you will enter your OneSignal’s API Key and create a key/value pair during the configuration setup. This key/value pair must match the segment you created in OneSignal. When finished, set your automation to “Active.”
When a contact goes through your automation, the key/value pair tag is pushed to OneSignal. Any tag you send to OneSignal from this action will be created in OneSignal if it does not already exist for contacts, and it will be updated if it does.
To find the key/value pair tag, log in to your OneSignal account and then navigate to Audience > Users.
Step-by-step instructions
-
Create a segment in OneSignal:
- Log in to your OneSignal account
- Navigate to Audience > Segment > New Segment
- Create your new segment by adding the “User Tags” filter for the key/value pair created in step 3 above. To learn more, read OneSignal’s guide on segmentation
- Create the message you want to send to your segment. To learn more, read OneSignal’s guide on in-app messaging.
- Gather the OneSignal app-level API key and save it to a file for step 5 (below). This API key is located under the ActiveCampaign App > Keys & IDs.
- From ActiveCampaign, create or edit an automation.
-
Drag the “OneSignal - Send a push notification” action to your automation. You can find this action under the “Apps” portion of the automation action menu. Enter the following information into the fields provided:
- OneSignal API key
- Data tag key
- Data tag value
- For best practices on creating the key/value pair, please read OneSignal’s Add user data tags help article
- Finish building your automation, then set it to “Active.”
Connect OneSignal to ActiveCampaign with the "OneSignal - Send a push notification" automation action
This automation action lets you send push notifications to web and mobile devices.
What to expect
Once you add the “OneSignal - Send push notification” action to your automation, you will walk through the OneSignal authentication and configuration steps. You can use a OneSignal template for your push notification or manually create your message in the configuration.
After you connect the integration and set your automation to “Active,” contacts who enter your automation and make it to your OneSignal action are sent a push notification to the web or mobile device. Additionally, the activity stream on contact records will indicate that the contact has entered and completed your automation.
You can find reporting for this integration in your OneSignal account. You can also use ActiveCampaign to create an advanced search of all contacts who entered your OneSignal automation.
This integration does not add tags to contacts. To add tags to contacts who received a push notification, you must add the “Add a tag” action to your automation, following the OneSignal action.
Step-by-step instructions
- Ensure you have the following setup on the OneSignal side: OneSignal account configured to send push notifications, ActiveCampaign App, and Templates (recommended).
- Gather the following information from OneSignal and save it to a file for step 5 (below):
- User auth key - This is the account-level key and is located under Account & API Keys
- OneSignal - This is the app-level API key and is located under the ActiveCampaign App > Keys & IDs for the ActiveCampaign app
- From ActiveCampaign, create or edit an automation.
- Drag the OneSignal action to your automation. It is under the “CX Apps” portion of the automation action menu.
-
Complete the following steps in the OneSignal automation action to connect the integration:
- Paste your OneSignal User Auth Key into the field provided, then click “Connect”
- Select the web app you wish to use from the dropdown menu
- Paste the web app API key
-
Select the push notification template you wish to use (recommended). You can manually create your push notification here if you do not want to use a template.
- To manually create a push notification in the automation action: enter your URL, heading (subject line), and content
- You can also use personalization tags for the following in your message: Contact, Account, Deal, Ecommerce, and Custom objects
- ActiveCampaign's personalization tags do not work with OneSignal's templates
- Click the “Finish” button
Capture email address for OneSignal with ActiveCampaign Forms
This option is for advanced users. You need to be comfortable with code. Our Customer Experience team cannot help you implement or troubleshoot code.
With the OneSignal Web SDK, you can add custom code to your ActiveCampaign Forms to capture the Contact’s email address on submission and add them as subscribers in OneSignal.
First, install the OneSignal Web SDK on your website by following the startup guide from OneSignal’s documentation.
Once you have verified that the Web SDK has been installed, the next step is to add the ActiveCampaign form to your site.
In ActiveCampaign:
- Click Website > Forms on the left menu.
- Create a new form and choose the “Inline form” option.
- After designing the form, click the “Integrate” button on the top right corner.
- Find the “full embed” code, select it, and copy it.
In your website’s HTML (where the ActiveCampaign Form will be displayed):
- Paste in the copied form code.
- Search for a function in the included javascript called form_submit. The first line in this function should be e.preventDefault() This is important.
- The OneSignal code should be inserted after the e.preventDefault() line in this function.
-
On a new line below the e.preventDefault() line, add the following code:
var userEmail = document.getElementById("email").value;
OneSignalDeferred.push(async function(OneSignal) {
await OneSignal.User.addEmail(userEmail);
await OneSignal.login(userEmail);
});
When your ActiveCampaign form is submitted, the submitter’s email address will be passed into the OneSignal External ID field.
Troubleshooting
Review your Template settings to allow pushes on various devices.
- Web Push troubleshooting guide
- Mobile Push troubleshooting guide
- Common reasons why Web Push notifications are not showing on your device
- Common reasons why Mobile Push notifications are not showing on your device