Introduction
The information provided in this document is to benefit app developers so that it is understood the structure of payloads sent to the app. In most cases, the Emarsys SDK handles the payloads automatically. However, in advanced use cases, developers may wish to understand the structure so that they can use parts of the payload in other actions.
Push Payload
Android
{
"title": "Game Request",
"body": "Bob wants to play poker",
"image_url": "https://www.image.com/image.png",
"ems": {
"inapp": {
"campaign_id": "222",
"url": "https://www.wikipedia.org/"
},
"default_action": {
"type": "MEAppEvent",
"name": "DeepLink",
"payload": {
"url": "lsl://bag"
}
},
"actions": [
<ACTIONS>
]
}
}
Field | Description |
---|---|
title |
The title of the notification |
body |
The body of the notification |
image_url |
The image URL of the notification |
ems |
Emarsys properties (In-app, default action) |
inapp |
The In-app message that comes with the push notification with push to In-app campaigns |
default_action |
The default action of the notification for campaigns that include tap actions. |
type |
The type of the action (MEAppEvent, DeepLink, CustomEvent) |
name |
The name of the action |
payload |
The custom parameters of the action ({ "key1": "value1", "key2": "value2" }) |
actions |
The list of actions of the message |
iOS
{
"aps": {
"alert": {
"title": "Game Request",
"body": "Bob wants to play poker"
},
"mutable-content": 1
},
"image_url": "https://www.image.com/image.png",
"ems": {
"inapp": {
"campaign_id": "222",
"url": "https://www.wikipedia.org/"
},
"actions": [
<ACTIONS>
]
}
}
Field | Description |
---|---|
aps |
Dictionary containing one or more additional Apple-defined keys |
alert |
The information for displaying an alert |
title |
The title of the notification |
body |
The body of the notification |
mutable-content |
The notification service app extension flag |
image_url |
The image URL of the notification |
ems |
Emarsys properties |
actions |
The list of actions of the message |
Tap Actions
Marketers have ability to add tap actions (a.k.a. Call To Action buttons). When adding the action, there is a number of different action types that marketer can choose from. Below are payload actions examples split by payload type.
Application event
{
"id": "id1",
"title": "App event",
"type": "MEAppEvent",
"name": "nameValue",
"payload": {
"key1": "value1"
}
}
Deep link
{
"id": "id1",
"title": "Deep Link",
"type": "MEAppEvent",
"name": "DeepLink",
"payload": {
"url": "lsl://product/1234"
}
}
External URL
{
"id": "id2",
"title": "External URL",
"type": "OpenExternalUrl",
"url": "https://bestrun.com"
}
Custom event
{
"id": "id3",
"title": "Custom event",
"type": "MECustomEvent",
"name": "nameValue",
"payload": {
"key1": "value1"
}
}
Dismiss button
{
"id": "id4",
"title": "Dismiss button",
"type": "Dismiss"
}
handleEvent payload (push and in-app)
Application Event and Deep Link events trigger an action in the eventHandler.handleEvent(<eventName: String>, <payload: Dictionary>?) method with the following payload:
Application event
Application Event
{
"eventName": "EventName",
"payload": {
"key1": "value1",
"key2": "value2"
}
}
Deep link
{
"eventName": "DeepLink",
"payload": {
"url": "lsl://product/1234"
}
}
Mobile Inbox
{
"count": 24,
"messages": [
{
"id": "58577",
"title": "1.06.2021.",
"body": "no buttons",
"campaignId": "100160594",
"receivedAt": 1622533763,
"updatedAt": 1622533763,
"expiresAt": null,
"tags": [],
"collapseId": "",
"properties": {}
},
{
"id": "58576",
"title": "1.06.",
"body": "hi there",
"campaignId": "100160593",
"receivedAt": 1622532026,
"updatedAt": 1622532026,
"expiresAt": null,
"tags": [],
"collapseId": "",
"properties": {},
"ems": {
"actions": [
{
"id": "123",
"title": "click me",
"type": "MEAppEvent",
"index": 0,
"name": "big sale",
"payload": {
"url": "lsl://product/1234"
}
}
]
}
},
...
]
}
Field | Description |
---|---|
count |
The number of messages in the list |
messages |
List of messages |
id |
The ID of the message |
title |
The title of the message |
body |
The body of the message |
imageUrl |
The image URL of the message |
campaignId |
The ID of the campaign |
receivedAt |
The time the message was received in unix timestamp |
updatedAt |
The time the message was updated in unix timestamp |
expiresAt |
The time the message expires in unix timestamp |
tags |
The tags of the message (e.g. high, seen, opened, pinned) |
collapseId |
The internal ID of the message |
properties |
The custom parameters of the message |
ems |
Emarsys properties |
actions |
The list of actions of the message. Marketers have 3 options to select from for the type of action which are; Application Event, Deep Link and External URL. |
Inbox Actions
Deep link
...
"ems":{
"actions":[
{
"id":"123",
"title":"click me",
"type":"MEAppEvent",
"index":0,
"name":"big sale",
"payload":{
"url":"lsl://product/1234"
}
}
]
}
...
External URL
...
"ems":{
"actions":[
{
"id":"123",
"title":"click me",
"type":"OpenExternalUrl",
"index":0,
"name":"big sale",
"payload":{
"url":"https://bestrun.com"
}
}
]
}
...
Application Event
...
"ems":{
"actions":[
{
"id":"123",
"title":"membership upgrade",
"type":"MEAppEvent",
"index":0,
"name":"big sale",
"payload":{
"key1":"value1"
}
}
]
}
...