OneSignal Integration
Notifying users is available for Articles, Videos, and Galleries, and its main purpose is to send in-browser notifications to users when a new article is published or updated. We've automated the setting up of notifications for each post so editors don’t have to leave the CMS to copy/paste URLs, and so on.
Developer Guide:
Prerequisites
Before proceeding, make sure you have registered with the OneSignal platform.
The information needed to set up the OneSignal feature in the CMS
This information must be provided to the Sportal365 support team
-
Populate URL:
- Key:
populate_url
- Description:
url
string: The external URL which should be called to get the URL for the notification.
headers
object: All headers that should be sent to the external API. - Value:
{ "url": "https://your-enpoint", "headers": { "Authorization": "Authorization" } }
-
Additional development needed
Keep in mind that if you want to use automaticaly prefiled URLs inside the CMS you need to create a custom endpoint, that we can call and receive the URL associated to the content
Notification URL Implementation RequirementsRequest type:
POST
Request body:
{ "id": "<article/video/gallery id>", "entity_type": "<article/video/gallery>" }
Expected response:
{ "url": "<full url of the article/video/gallery>" }
- Key:
-
Authorization:
-
Key:
authorization
-
Description: Stores the API key and App ID for OneSignal.
-
Value:
{ "apiKey": "Your OneSignal API key", "appId": "Your OneSignal APP ID" }
-
-
Delivery:
-
Key:
delivery
-
Description: Specifies the default delivery option. Available values are “Immediately", “Delayed“, and “Intelligent“. Leave it empty if you do NOT want the default value.
-
Value:
{ "default": "Immediately" }
-
-
Segments:
-
Key:
segments
-
Description: Configures the default segment and all available segments.
default
string: Default value that should be populated in the OneSignal modal. The value should be from the “all array" mentioned below. Leave it empty if you do NOT want the default value.
all
array: The array should contain the segments from OneSignal from which the editor should choose. These segments are used for sending notifications to groups of people. (segments example: "All" "Subscribed Users", "Active Users") More information here: https://documentation.onesignal.com/docs/segmentation
-
Value:
{ "default": "Subscribed Users", "all": ["All", "Subscribed Users", "Active Users"] }
-
With these configurations, developers can successfully integrate OneSignal into Sportal365 CMS.
Editor Guide:
User Interface Information
Once the article/video/gallery is created, on the Edit screen, a NOTIFY USERS button should be added
next to the SAVE and PREVIEW buttons.
Clicking on the NOTIFY USERS will generate a modal with a form with the following fields:
Available options in the OneSignal modal
When the configuration panel opens, all fields will be pre-filled:
- Notification Image: by default (only if the ‘main media’ image is selected)
- Delivery: аvailable values are:
- Immediately means that the article notification will be sent instantly.
- Intelligent means that the system will send the notification when users are most active on your website.
- Delayed gives you a chance to set a specific date for the notification.
- Leave it empty if you do not want the default value.
- Notification URL: by default (populated only if the client gives an external URL that we can call to receive the notification URL).
- Notification title: by default.
- Notification Description: by default.
- Recipients: (multiple choice) These are the segments from OneSignal that the editor should choose from
- For Example:"All", "Subscribed Users", "Active Users"
You can set up the CMS to display default options or not. Your choice. Also, in the
configuration panel, you will see a warning message telling you whether the article is
published or not.
Validation rules and restrictions
- Delivery type
The delivery types will be “Immediately“, “Intelligent“ and “Delayed“. - Delivery date
This field will be pre-filled with the current time. - URL
NOTE: There is no validation for links. - Title
The user will be able to enter a title with the following restrictions: at least 3 characters
long and max 40 characters long - Description
The user will be able to enter a title with the following restrictions: at least 3 characters
long and max 40 characters long - Recipient
A multi-select drop-down with all the segments from the feature control is presented as
options. - Validation
The notification can’t be created in case of a missing element; thus, each field will have a
validation rule for empty or insufficient text. The text needs to be at least three characters
long.
Updated over 1 year ago