Calling a CX Rule via the API
Journey Orchestration allows users to create rules that make Realtime actions and decisions in sub 100 milliseconds. Rules are exposed to the outside world as RESTful web APIs.
Rules will typically be called on a webpage via JavaScript using a HTTP request. Every rule requires input data passed though as JSON message to execute.
Because rules can be created to cater for many different business scenarios, there is no standard API that accepts specific JSON.
However the below scenario describes how to call a Realtime CX (RTCX) rule called “examplerule” for a client called “exampleclient”. The rule would subsequently send a Realtime Email and SMS message.
The endpoint rule would require the following details to POST to:
URL:
https://dde.alterian.net/invoke/dev/exampleclient/examplerule
Message Data:
{
"Customer Id": 1,
"Email Address": "JoeBloggs@alterian.com",
"Customer Name": "Joe Bloggs",
"Order Date": "12/08/2018 11:14:00",
"Delivery Date": "12/09/2018 11:14:00",
"Delivery Postcode": "BS1 2AB",
"Order Number": "12345",
"Product Name": "A Sofa",
"Sofa Image URL": "https://imagehost.com/Image.png"
}
Headers (*Optional):
Key | Value |
|
|
*If required you can configure a RTCX rule to require an api_key in the header for authentication. This is not enforced by default but should be applied whenever the call can change, delete or export customer data.
Invoking a rule from the API help
Expanding a rule will provide extra information around how the rule can be invoked and the data expected.
Clicking the Try it out button will allow users to edit the example data and invoke the rule
Executing the rule in the API help also provides further invoke information such as a curl string and request URL.
After the invoke response information is also available.
If the rule is designed to return data to the calling system this will also appear in the response area of the help
The following recording shows the creation and invocation of Rule Groups