Once you have created and published a transactional event, you need to integrate the triggering of this event into your website.
Event configuration is detailed in this section.
For example, you want a “Cart abandonment” event to be triggered whenever one of your clients leaves your website before purchasing the products in their cart. To do this, as a web developer, you must use the REST Transactional Messages API.
The transactional event is sent through a POST request with the following URL structure:
POST https://mc.adobe.io/<ORGANIZATION>/campaign/<transactionalAPI>/<eventID>
<ORGANIZATION>: your personal ORGANIZATION ID. Refer to this section.
<transactionalAPI>: the Transactional Messages API endPoints.
The name of the Transactional Messages API endpoint depends on your instance configuration. It corresponds to the value “mc” followed by your personal organization ID. Let’s take the example of the Geometrixx company, with “geometrixx” as its organization ID. In that case, the POST request would be as follows:
POST https://mc.adobe.io/geometrixx/campaign/mcgeometrixx/<eventID>
Note that the transactional messages API endpoint is also visible during the API preview.
<eventID>: the type of event you want to send. This ID is generated when creating the event configuration (refer to this section).
The request must contain a “Content-Type: application/json” header.
You must add a charset, for example utf-8. Note that this value depends on the REST application you are using.
-X POST \
-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' \
The event data are contained inside the JSON POST body. The event structure depends on its definition. The API preview button in the resource definition screen provides a request sample. Refer to this section.
The following optional parameters can be added to the event content to manage the sending of transactional messages linked to the event:
The values of the “expiration” and “scheduled” parameters follow the ISO 8601 format. ISO 8601 specifies the use of the uppercase letter “T” to separate the date and time. It can however be removed from the input or output for better readability.
The POST response returns the transactional event status at the time it was created. To retrieve its current status (event data, event status…), use the Primary Key returned by the POST response in a GET request:
GET https://mc.adobe.io/<ORGANIZATION>/campaign/<transactionalAPI>/<eventID>/
Sample request
POST request to send the event.
-X POST https://mc.adobe.io/<ORGANIZATION>/campaign/mcAdobe/EVTcartAbandonment \
-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'
{
"email":"test@example.com",
"scheduled":"2017-12-01 08:00:00.768Z",
"expiration":"2017-12-31 08:00:00.768Z",
"ctx":
{
"cartAmount": "$ 125",
"lastProduct": "Leather motorbike jacket",
"firstName": "Jack"
}
}
Response to the POST request.
{
"PKey":"<PKEY>",
"ctx":
{
"cartAmount": "",
"lastProduct": "",
"firstName": ""
}
"email":"",
"scheduled":"2017-12-01 08:00:00.768Z",
"expiration":"2017-12-31 08:00:00.768Z",
"href": "mcAdobe/EVTcartAbandonment/<PKEY>",
"serverUrl":" https://myserver.com ",
"status":"pending",
"type":""
}
In the response, the “status” field allows you to know whether the event has been processed or not: