Skip to content
Integrations

Connect and use OneSignal Integration

Last updated: June 10, 2021

Applies to:

All products and plans

Connect your OneSignal account to HubSpot to set up OneSignal push notifications using Workflows, view push notifications on contacts' activity timelines, and segment users based on engagement with push notifications.

Integration requirements

Connect the Integration

  • In your HubSpot account, click the Marketplace icon marketplace in the main navigation bar, then select App Marketplace.
  • Use the search bar to locate and select the OneSignal integration.
  • In the upper right, click Install app.
  • Login to your OneSignal account.
  • In the pop-up box, enter your Application ID and API key from your OneSignal account. You can enter multiple IDs and keys in order to connect more than one OneSignal application.
  • Click Install app.
  • You will be redirected to the Connected apps page.

Use the Integration

You can use the One Signal integration to create and send OneSignal push notifications using Workflows, view push notifications on contacts' activity timelines, and segment users based on engagement with push notifications.

  • In your HubSpot account, click the Marketplace icon marketplace in the main navigation bar. Under Manage, select Connected apps.
  • Click OneSignal.
  • Click Actions on the selected OneSignal app to add additional apps or remove apps.

Please note: for your OneSignal users to receive push notifications, you need to use the OneSignal setEmail SDK Method.  Users must still subscribe to your site or app to receive push notifications. Please review OneSignal’s SDK documentation.


Create OneSignal push notifications (MarketingHub, SalesHub and ServiceHub Professional and Enterprise only)

  • In your HubSpot account, navigate to Automation > Workflows.
  • In the top right, click Create workflow.
  • In the left panel, select Contact-based and click Next in the top right.
  • Set your enrollment triggers.
  • Click + to add an action.
  • In the right panel, select Send OneSignal notification.

View push notifications on activity timeline

  • In your HubSpot account, navigate to Contacts > Contacts.
  • Click the name of a contact you've sent a push notification to.
  • On the activity timeline, you can view the OneSignal activity.

onesignal-timeline

Use HubSpot form submissions to link HubSpot contacts to OneSignal users 

To use this functionality, You need to make sure you have the appropriate code in <head> from your OneSignal Web Push Settings.

You have two options for capturing and passing email addresses to OneSignal:

  1. Place the following globally in your <head> … </head> to apply across form submissions:

window.addEventListener('message', event => {
if(event.data.type === 'hsFormCallback' && event.data.eventName === 'onFormSubmit') {
OneSignal.push(function() {
OneSignal.setEmail($("input[name=email]").val())
.then(function(emailId) {
// Callback called when email have finished sending
console.log("emailId: ", emailId);
});
}
});

  1. Edit the embed script for one of your HubSpot Forms directly. You will need to insert your portal ID and form ID from your account. Here's an example:
    <script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2.js"></script>
    <script>
    hbspt.forms.create({
    region: "na1",
    portalId: "YOUR PORTAL ID",
    formId: "YOUR FORM ID",
    onFormSubmit: function($form) {
    OneSignal.push(function() {
    OneSignal.setEmail($("input[name=email]").val())
    .then(function(emailId) {
    // Callback called when email have finished sending
    console.log("emailId: ", emailId);
    });
    });
    }
    });
    </script>