Using Android Delivery Channel in a Campaign
Delivery Channels are specified per-message in the campaign editor. To configure a message for GCM, the sending mode must be “SMS Only” and the Delivery Channel should be the GCM Delivery Channel configured above.
FCM Message Payloads
Connect's Android Delivery Channel assumes that the content used to create each message is JSON object. A JSON payload in FCM must contain at least two elements:
to - the Registration Token of the destination.
data - a JSON array containing the key/value pairs of the message payload.
A sample JSON message is shown below.
{
"to"
:
"f90xF2fqTy-rE02KyU-_Xs:APA91bFnF8yEcOFWWrui26GCn_1naDZCY5C0Y8jSxElqIM2tnt0Y9ykWWnFX47H1xS_4mt1FUt7Jxs996Q4ziWGA_sNQwRT74LV7XjRPJcBv5adED9wTRJCS4lXx4Z8TzLV4gVVPPszs"
,
"data"
: {
"score"
:
"5x1"
,
"time"
:
"15:10"
}
}
FCM allows additional JSON keywords to be defined to control how the GCM servers handle the message. See the the FCM message documentation for more details.
The Android Delivery Channel supports the Legacy HTTP Server Protocol .
Configuring GCM Message Content in the CONNECT Campaign Editor
In the message content screen, specify the GCM content as a short text content URL. Static content or scripted static content URLs may use CONNECT merge tags. Note that GCM requires the message payload to contain the Registration ID of the destination device, so if static content is used, it must contain the merge tag of the Registration ID:
In the fragment above, <%[Android Registration ID]%> is the merge tag for the customer attribute that contains the GCM Registration ID for the Android device.Other merge tags may be used in the JSON content as well. For example, if the score and time values used above were supplied as Event Parameters in an Event-Triggered campaign, they could be used as merge tags in the static content template shown below
{
"to"
:
"<%[Android Registration ID]%>"
,
"data"
: {
"score"
:
"<%[evnt:Score]%>"
,
"time"
:
"<%[evnt:Time]%>"
}
}
This static content template could be used to produce the sample JSON message shown above.