Sending push deep links and custom data
This page explains what you choose when you send a push message, and which payload your app receives as a result. Use it to connect the options in the Program Builder push node to the code in your app.
Your marketing team usually sends the push message, and your development team builds the app that receives it. Both need to agree on the option and the values before a deep link or a custom data payload works.
You can send the same options with the omnichannel messaging API. See Send the same options with the API.
Choose what happens when a user taps
The push notification node has an On tap drop-down menu with four options. Your choice decides which keys arrive in the payload, and therefore what your app must do.
| On tap option | Payload your app receives | What your app must do | Tap tracked? |
|---|---|---|---|
| Open app | No dd_deepLink and no dd_data | Nothing. Your app opens at its launcher screen. | No |
| Open deep link | dd_deepLink, holding a url and a trackingUrl | Route the user to the correct screen for that URL. | Yes |
| Pass data | dd_data, holding the JSON that you entered | Read the values and start the right function. | No |
| Open a survey, page, or form | dd_deepLink, holding the address of the published page or form | Nothing. The link opens in the device browser. | Yes |
Custom data is sent only with the Pass data option. If you enter custom data and then change the On tap option, Dotdigital Marketing clears it.
Only the two link options record a tapDotdigital Marketing records a tap only when the payload contains a
dd_deepLinkobject with atrackingUrlvalue. The Open deep link and Open a survey, page, or form options produce that object. The Open app and Pass data options do not, so your push reporting shows no clicks for those messages.If you need click reporting for a message, use Open deep link or Open a survey, page, or form.
Open app is not a faultWith Open app, the operating system opens your launcher screen and nothing else happens. This is the intended behaviour, not a broken deep link. If you expect a specific screen to open, check that the message uses Open deep link and that your app handles that URL.
Enter values for each platform separately
The Open deep link and Pass data options both let you set a different value for each platform. The two options present this differently:
- Open deep link has two fields: Android deep link or URL and iOS deep link or URL.
- Pass data has two tabs: iOS and Android.
Complete the field or tab for each platform that your app supports.
The other two options need no per-platform values. Open app sends no link, and Open a survey, page, or form sends the same web address to both platforms.
Complete both platformsIf you complete only one platform, the message works on that platform and does nothing on the other. Nothing warns you about the empty field or tab.
Deep link URLs often differ between platforms, because each platform registers its own URL scheme. Custom data can usually be the same for both, but you must still enter it twice.
Deep link length limits
The deep link fields have separate character and byte limits, and the byte limit is lower on iOS:
| Field | Characters | Bytes |
|---|---|---|
| Android deep link or URL | 2048 | 4096 |
| iOS deep link or URL | 2048 | 2048 |
Watch the byte limit, not just the character countA character outside the ASCII range uses more than one byte. Accented characters, non-Latin scripts, and percent-encoded values therefore reach the byte limit before the character limit.
The iOS byte limit is half the Android limit, so a long URL can fit on Android and fail on iOS. Check both fields when you use a long URL with query string values.
Personalisation in a deep link is not URL encodedYou can insert a personalisation token into a deep link field. Dotdigital Marketing replaces the token with the contact's value as plain text, and does not URL encode it.
A value that contains a space, an ampersand, or a question mark therefore produces a broken link. If you personalise a URL, use a data field that holds a safe value, such as an ID.
A long value can also push the finished URL past the length limits above, so allow room for it.
Send a deep link
Select Open deep link, then enter the value in the Android deep link or URL and iOS deep link or URL fields.
Each field accepts two kinds of value:
- A deep link into your app, such as
myappscheme://product/123. Your app must register the URL scheme. - A web address, such as
https://example.com/product/123. The device opens it in the browser, unless your app claims that address with an Android App Link or an iOS universal link.
Your app must be able to receive the value that you send. Register a custom URL scheme, a universal link, or an Android App Link first. For the code you need, see the deep link section of the guide for your platform:
Send a link to a survey, page, or form
Select Open a survey, page, or form, then choose the published landing page or form that you want to open.
This option works differently from the others:
- You choose an asset, not a URL. Dotdigital Marketing resolves your choice to the published web address of that page or form when it sends the message.
- Both platforms get the same address. The per-platform fields are hidden, because a web address works on iOS and Android alike.
- The tap is tracked. Dotdigital Marketing uses the same deep link mechanism as the Open deep link option, and adds a tracking link when the message is sent from a program.
Your app needs no extra code. The address starts with https, so the device opens it in the browser rather than in your app.
This option cannot be silent, and cannot carry custom dataIf you set Silent push notification to Yes and then select this option, Dotdigital Marketing sets the silent setting back to No and restores the Title and Message fields. A silent message has no alert for the user to tap, so a tap action has nothing to act on.
Dotdigital Marketing also clears any custom data that you entered. Only the Pass data option keeps custom data.
Your app can intercept the link if you need toThe SDK returns the address to your app in the
dd_deepLinkobject, in the same way as a custom deep link. If you want to open the page inside your app, for example in a web view, read the URL and handle it yourself instead of letting the SDK open it. See Handling deep links for iOS, or Handling deep links for Android.
Send custom data
Select Pass data, then enter your JSON in the iOS and Android tabs.
Dotdigital Marketing delivers the JSON to your app in the dd_data object and does not change its structure. Your app decides what to do with it. Use this to build advanced push handling while you still send the message through Dotdigital Marketing.
For example, this data:
{
"screen": "product-detail",
"productId": "123"
}arrives in the payload as:
{
"dd_data": {
"screen": "product-detail",
"productId": "123"
}
}
On Android, the values arrive as JSON stringsAn FCM data payload can hold only text values, so Dotdigital Marketing converts the
dd_dataanddd_deepLinkobjects to JSON strings before it sends them.Our SDKs convert them back for you. On Android,
ComapiClient.parsePushMessage()returns the values as objects. If you readRemoteMessage.getData()directly instead, you get the raw JSON string and must parse it yourself.
Your app is responsible for validating this data. Treat every value as untrusted input, and check that each key exists and has the type you expect before you use it.
Using personalisation in the data payload
You can insert a personalisation token into the Data field to send a value for each contact.
Dotdigital Marketing replaces the token with the contact's value as plain text. It does not adjust the result to keep the JSON valid, so you must write the JSON in a way that survives any value.
Always put quotation marks around a tokenWrite
{"userId": "@CUSTOMERID@"}, not{"userId": @CUSTOMERID@}.Without the quotation marks, a contact who has no value produces
{"userId": }, which is not valid JSON. Your app then fails to parse the payload, and nothing points back to the push message as the cause.
Check the data fields that you insertA value that contains a quotation mark, a backslash, or a line break also breaks the JSON, because Dotdigital Marketing inserts the characters exactly as they are stored. A first name stored as
O"Brienproduces{"name": "O"Brien"}, which your app cannot parse.Before you use a data field in a payload, check the values that your contacts hold in it. Prefer fields with predictable values, such as an ID or a numeric field.
Test your message with a contact who has an empty value in each field that you insert, and with a contact whose value is unusually long.
For the code that reads dd_data, see the custom data section of the guide for your platform:
Send a silent push message
The push notification node has a Silent push notification setting. Set it to Yes to deliver data to your app without notifying the user.
Use a silent push to start an action in your app in the background, for example to refresh cached content.
A silent push does not deliver your title or messageWhen you set Silent push notification to Yes, Dotdigital Marketing removes the alert from the payload. On Android it omits the
notificationobject. On iOS it omits thealert,badge,sound, andcategoryvalues.The Title and Message fields stay on screen, and Message is still required, but the device never displays them. Put everything that your app needs into the Data field instead.
Your app receives only the data. Nothing appears on the device, so your app must receive the message and act on it.
Use a silent push with the Pass data option, so that your app has something to act on. A silent push has no alert for the user to tap, so a tap action serves no purpose. If you select Open a survey, page, or form, Dotdigital Marketing sets the silent setting back to No.
What a silent push sends
| Platform | What Dotdigital Marketing sends |
|---|---|
| Android, through FCM | Your data values, with no notification object. FCM therefore displays nothing, and your app must handle the message. |
| iOS, through APNS | Your custom payload, plus content-available set to 1 in the aps dictionary. The push type is background and the priority is 5, which asks iOS for a background update rather than an alert. |
The operating system does not guarantee silent push deliveryiOS treats silent pushes as low priority. The system may delay them, or it may not deliver them, depending on battery level, network conditions, and how often the user opens your app. Android applies similar restrictions in Doze mode.
Do not rely on a silent push for anything critical.
Your app needs extra configuration to receive a silent push. See the silent push section of the guide for your platform:
To send a silent push with the API, see Sending a silent push with the API.
Title and message limits
A push notification displays a maximum of 160 characters in the title and in the message. The operating system replaces extra characters with an ellipsis.
The title and the message behave differently on each platform. On Android, the device shows the title above the body text. On iOS, the device joins the title to the front of the body text.
Send the same options with the API
You can send push messages with the Program Builder or with the omnichannel messaging API. The API uses the channel identifier nativePush.
Which endpoint to call
| To do this | Use |
|---|---|
| Send one push message | Send a new message |
| Send push messages to many app users at once | Send a batch of new messages |
| Check the state of a message you sent | Retrieve the current state of a message |
Before you build a request, read these guides:
- Calling the Omnichannel API, for authentication and the base request.
- Addressing your messages, for the
toblock. Push messages are addressed with theprofileId, which comes from thesubclaim of the JWT that your app supplies. See The role of the sub claim. - Channel selection, for the
rulesandruleSetarrays. IncludenativePushto send to the push channel. - Custom messages, for the
customBodyproperty. - Push, for the full push channel reference and more examples.
How each Program Builder option maps to the API
This table maps each Program Builder option to its API equivalent:
| Program Builder | API |
|---|---|
| Open app | Send no deepLink block |
| Open deep link | channelOptions.nativePush.deepLink, with a url under fcm and under apns |
| Open a survey, page, or form | No direct equivalent. Put the published web address of the page in the deepLink block yourself |
| Pass data | customBody.nativePush.platforms, with your data under fcm.data and apns.payload |
| Silent push notification | customBody.nativePush.platforms.isSilent, set to true |
| Click tracking | deepLink.trackingLink. You supply the URL that the SDK calls when the user taps the message |
| Title and Message | The title and body properties of the request |
Click tracking works differently in the APIIn the Program Builder, Dotdigital Marketing creates the tracking link for you and reports the taps in your push statistics.
In the API, you supply your own
trackingLink. The SDK calls that URL when the user taps the message, so you can record the tap in your own system.
The API also offers options that the Program Builder does notUse
customBodyto reach platform features that the push node does not expose, including:
- An iOS badge count, with
apns.badge.- A custom sound, with
apns.sound.- An image in the notification, with
fcm.notification.image.- An iOS subtitle, with a structured
apns.alertobject.When you set
customBody, the API uses those values exactly as you supply them and ignores thetitleandbodyproperties.
Build the dd_deepLink and dd_data objects yourself when you use customBodyWith
channelOptions, Dotdigital Marketing builds the payload for you. WithcustomBody, you build it. Add add_deepLinkordd_dataobject insidefcm.dataandapns.payload, using the same shape that this page describes, so that our SDKs recognise it.
Sending a silent push with the API
To send a silent push, set isSilent to true. This property sits inside customBody.nativePush.platforms, alongside the apns and fcm objects, so a silent push always uses customBody.
{
"to": {
"profileId": "05aed392-4de6-4ffe-8956-d855f854881d"
},
"customBody": {
"nativePush": {
"platforms": {
"isSilent": true,
"apns": {
"alert": "Not displayed",
"payload": {
"dd_data": {
"screen": "product-detail",
"productId": "123"
}
}
},
"fcm": {
"notification": {
"title": "Not displayed",
"body": "Not displayed"
},
"data": {
"dd_data": {
"screen": "product-detail",
"productId": "123"
}
}
}
}
}
},
"rules": [
"nativePush"
]
}
You still supply the alert valuesThe request schema requires
alertfor APNS, andtitleandbodyfor FCM, even whenisSilentistrue. The device does not display them, so put everything that your app needs into the data payload.
Getting feedback on an API send
The push channel is a send-and-forget channel, so you receive two kinds of receipt: Sent, and Failed if the message reaches none of the profile's devices.
To receive receipts, you can use Message Events or Webhooks.
A receipt tells you that Dotdigital Marketing sent the message to Apple or Google. It does not tell you that the device displayed it. If a user has not granted notification permission, or the APNS environment does not match the build, you still receive a Sent receipt. See Push troubleshooting if messages do not arrive.
Updated 7 days ago