Triggering a signal activity triggering-a-signal-activity
In an 51黑料不打烊 Campaign Standard workflow, there can be one or more External signal activities. These activities are 鈥榣isteners鈥 that wait to be triggered.
Campaign Standard APIs let you trigger an External signal activity to call a workflow. The API call can include parameters that will be ingested into the workflow鈥檚 events variables (an audience name to target, a file name to import, a part of message content, etc.). This way, you can easily integrate your Campaign automations with your external system.
To trigger a workflow, follow the steps below:
-
Perform a GET request on the workflow to retrieve the External signal activity trigger URL.
GET https://mc.adobe.io/<ORGANIZATION>/campaign/workflow/execution/<workflowID>
-
Perform a POST request on the returned URL to trigger the signal activity, with the 鈥渟辞耻谤肠别鈥 parameter in the payload. This attribute is mandatory, it lets you indicate the triggering request source.
If you want to call the workflow with parameters, add them into the payload with the 鈥减补谤补尘别迟别谤蝉鈥 attribute. The syntax consists of the parameter鈥檚 name followed by its value (the following types are supported: string, number, boolean and date/time).
-X POST <TRIGGER_URL>
-H 'Authorization: Bearer <ACCESS_TOKEN>' \
-H 'Cache-Control: no-cache' \
-H 'X-Api-Key: <API_KEY>' \
-H 'Content-Type: application/json;charset=utf-8' \
-H 'Content-Length:79' \
-i
-d {
-d "source":"<SOURCE>",
-d "parameters":{
-d "<PARAMETER_NAME":"<PARAMETER_VALUE>",
-d "<PARAMETER_NAME":"<PARAMETER_VALUE>",
-d "<PARAMETER_NAME":"<PARAMETER_VALUE>",
-d "<PARAMETER_NAME":"<PARAMETER_VALUE>"
-d }
-d }
Sample request
Perform a GET request on the workflow.
-X GET https://mc.adobe.io/<ORGANIZATION>/campaign/workflow/execution/<workflowID> \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <ACCESS_TOKEN>' \
-H 'Cache-Control: no-cache' \
-H 'X-Api-Key: <API_KEY>'
It returns the workflow signal activity and the associated trigger url.
{
"PKey": "<PKEY>",
"activities": {
"activity": {
"signal1": {
...
"trigger": {
"href": "https://mc.adobe.io/<ORGANIZATION>/campaign/workflow/execution/<PKEY>/activities/activity/<PKEY>/trigger/"
},
...
}
}
}
}
To trigger a signal activity, perform a POST request on the trigger url with the 鈥渟辞耻谤肠别鈥. Add the 鈥减补谤补尘别迟别谤蝉鈥 attributes if you want to call the workflow with parameters.
-X POST https://mc.adobe.io/<ORGANIZATION>/campaign/workflow/execution/<PKEY>/activities/activity/<PKEY>/trigger \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <ACCESS_TOKEN>' \
-H 'Cache-Control: no-cache' \
-H 'X-Api-Key: <API_KEY>' \
-i
-d '{
-d "source":"API",
-d "parameters":{
-d "audience":"audience",
-d "email":"anna.varney@mail.com",
-d "template":"05",
-d "contentURL":"http://www.adobe.com",
-d "test":"true",
-d "segmentCode":"my segment",
-d "attribute":"2019-04-03 08:17:19.100Z"}
-d }'
If one of the parameters is not declared in the External signal activity, the POST request returns the error below, indicating which parameter is missing.
RST-360011 An error has occurred - please contact your administrator.
'contentURL' parameter isn't defined in signal activity.
XTK-170006 Unable to parse expression 'HandleTrigger(@name, $(source), $({parameters}))'.
RST-360000 Error while assessing 'HandleTrigger(@name, $(source), $({parameters}))' expression ('xtk:workflow:execution/activities/signal/trigger' resource)