Use API to Trigger Journeys Based on External Events

Updated 

Summary

You can run automated customer journeys that are triggered by API, based on external events, such as filling up a form by a user on a website, completion of an online purchase, or receiving a message on a social channel.

  • Method: HTTP

  • Endpoint: POST api/marketing-journey/trigger

  • Format: JSON

Headers

The following set of HTTP header fields provides required information about the request or response, or about the object sent in the message body. Both request headers and response headers can be controlled using these endpoints.

Key

Value

Description

Content-Type

application/json

request format should be JSON as the endpoint expects a JSON body.

Authorization

Bearer {{token}}

The credential used by an application to access an API.

Key

api-key

The API key acts as both a unique identifier and a secret token for authentication to a set of access rights.

Request Body Parameters

Parameters

Required/Optional

Description

Type

snType

Required

The schema of the audience data, such as - WHATSAPP_BUSINESS, SMS, EMAIL, TWITTER ID, FB ID, etc.

String

snID

Required

The unique identifier for the user, based on snType.

String

journeyID

Required

Aourney which needs to be triggered. List of journeys can be using the list journey API.

String

contextParams

Optional

Parameters that can be passed as additional information to the journey. For instance,

  • User-location: UK

  • Abandoned_cart: Yes

Map<String,String>

Request:

curl -X POST \

http://api2.sprinklr.com/api/marketing-journey/trigger \

-H 'Authorization: {{Enter your Access Token}}' \

-H 'Key: {{Enter your API KEY}}' \

-H 'Content-Type: application/json' \

-d '{

"snType": "string",

"snId": "string"

"journeyId” : "string"

"contextParams" :

{

"key1" :"string",

"key2" :"string"

}

}'

Response:

HTTP/1.1 204 (No Content)

--------------------------------------------------------------------------

Scenario with new Profiles: In case the Profile doesn’t exist, the client can make a call to create the New Profile before executing the Journey

  • Method: HTTP

  • Endpoint: POST api/marketing-journey/triggerWithNewProfile

  • Format: JSON

curl -X POST \

http://api2.sprinklr.com/api/marketing-journey/triggerWithNewProfile

-H 'Authorization: {{Enter your Access Token}}' \

-H 'Key: {{Enter your API KEY}}' \

-H 'Content-Type: application/json' \

-d '{

"journeyId": "string",

"contextParams": {

"key1": "string",

"key2": "string"

},

"unifiedProfile": {

"id": "id8",

"contact": {

"firstName": "Parth"

},

"profiles": [

{

"channelType": "EMAIL",

"channelId": "acme@sprinklr.com",

"name": "John Snow"

}

],

"createdTime": 1599816142000

}

}'