Success response
In default asynchronous mode, a
true
result does not signify that the message has been delivered to gateway, only that all validations have passed (eg. campaign exists, target set, params in correct format).
Review the campaign model properties page to see the available parameters.
Examples
Executing a campaign, targeting a single user by external ID and setting a number a variables in the campaign text.
curl --request POST \
--url https://external-api.xtremepush.com/api/external/execute/campaign \
--header 'content-type: application/json' \
--data '{
"apptoken": "YOURAPPTOKEN",
"id": "CAMPAIGNID",
"target_with_params": {
"crm-user-1": {"fname": "Alex", "balance": "100 EUR"},
"crm-user-2": {"fname": "John", "balance": "80 EUR"}
},
"target_by": "user_id"
}'
Executing a campaign on a specific time:
curl --request POST \
--url https://external-api.xtremepush.com/api/external/execute/campaign \
--header 'content-type: application/json' \
--data '{
"apptoken": "YOURAPPTOKEN",
"id": "CAMPAIGNID",
"target": ["user1", "user2"],
"target_by": "user_id",
"time": "2021-01-01 12:00 UTC"
}'
Additional campaign parameters
You can use any of the regular parameters for the campaign model to set or overwrite campaign properties to add content, segment users, etc.
For example you could add a payload like a deeplink to be used when the notification is opened:
curl --request POST \
--url https://external-api.xtremepush.com/api/external/execute/campaign \
--header 'content-type: application/json' \
--data '{
"apptoken": "YOURAPPTOKEN",
"id": "CAMPAIGNID",
"target": [123456],
"payload_add": [
{
"key": "URL_KEY",
"value": "https://m.example.com/deeplink/123456"
}
]
}'
Another example, executing a campaign that enables the webpush 'require interaction' option, and has a retry period of 2 weeks:
curl --request POST \
--url https://external-api.xtremepush.com/api/external/execute/campaign \
--header 'content-type: application/json' \
--data '{
"apptoken": "YOURAPPTOKEN",
"id": "CAMPAIGNID",
"target_by": "user_id",
"target": ["12345"],
"messages": {
"3": {
"push_require_interaction": false
}
},
"retry_for": 2,
"retry_for_period": "weeks"
}'