- Click Create flow on the Flow Manager page and again on the new window that is displayed.
- Select Empty flow [1], followed by Next [2].
- Choose API request [3] and then Next [4].
- On the following screen, enter a name and, if you wish, a description of the flow.
The flow editor page will now be displayed, and you'll see the API request component on the right-hand side. Within it, you'll need to configure the input arguments, i.e., the data to be sent in the body of the POST API request that will trigger the studio flow. Each argument can be mapped to a variable that can be used in the flow.
Note: For detailed information on arguments in Automated Notifications, please visit this section.
- Fill in the first text box with the "Argument name" - "contact[0]::name" that represents the contact name [5].
- Create the corresponding variable to be mapped to the flow - "contact_name" [6].
- If the variable does not exist, you can create a new one by clicking Create variable [7] and inserting the desired name in the modal that will be shown.
- Repeat the process and select Add new argument [8] to fill the needed arguments for the use case being addressed by the studio flow that is being created.
Arguments in Automated Notifications
In the context of Automated Notifications, the arguments must follow the structure of the event triggered by the Automated Notifications API. As an example, see the object below:
{
“contacts[0]::name”:“John Doe”,
“contacts[0]::preferred_channel”:“SMS”,
“contacts[0]::channels[0]::type”:“SMS”,
“contacts[0]::channels[0]::uri”:“+3519923456879”,
“data::doctor”:“Jane Doe”,
“data::appointment_date”:“May, 14th”,
“data::appointment_hour”:“10 am”,
“event_id”:“4190fc44-ecae-4ae8-904e-2b8b6937ce24",
“rule_id”:“ec96252d-63b0-41a1-a8ac-5481ab30b5c0",
“an_interaction_id”:“6408c2351c1e7d566d47ad0"
}
To add argument names, follow the naming strategy of the properties, e.g., “contacts[0]::name” for the contact name; “an_interaction_id” for the interaction ID. It is required to follow this naming strategy, otherwise, the flow will not be able to map the values received from the event to studio variables.
Note: If you do not know the structure of the event, but you have access to the payload sent to the Automated Notifications API, it should be similar to the code block below:
{
“external_id”: “external_id”,
“correlation_id”:“acad2d2a-acd7-444d-9c58-636a8acd11ef”,
“type”:“ANS_w_Interaction”,
“source”:“source”,
“contacts”:[
{
“name”: “John Doe”,
“channels”: [
{
“type”: “SMS”,
“uri”: “+3519923456789”
}
],
“preferred_channel”: “SMS”
}
],
“time_zone”:“+02:00",
“primary_date”:“2023-03-09T09:44:00.777376Z”,
“secondary_date”:“2021-06-24T16:00:00.777376Z”,
“data”:{
“doctor”: “Jane Doe”,
“appointment_date”: “May, 14th”,
“appointment_hour”: “10 am”
}
}
The mapping of the variables can be inferred from it, following some rules:
You're accessing an object
“data”:{
“doctor”: “Jane Doe”,
“appointment_date”: “May, 14th”,
“appointment_hour”: “10 am”
}
Navigate to the property from the root, e.g., if you want the doctor’s name, it can be accessed by navigating using the following convention: “data::doctor”. The "::" allows you to enter the object, if the property is inside a nested object, using the "::" to navigate inside that object.
You're accessing an array
“contacts”:[
{
“name”: “John Doe”,
“channels”: [
{
“type”: “SMS”,
“uri”: “+3519923456789”
}
],
“preferred_channel”: “SMS”
}
]
As in the object navigation, you can go inside the array using the "::" after the desired index (zero-based). Taking the above code as an example, assuming that you want to map the uri property, navigate to it like “contact[0]::channels[0]::uri”.
You're accessing a property directly in the root
“an_interaction_id”:“6408c2351c1e7d566d47ad0"
When the property to be mapped is in the root, to access it you need to add the property name (e.g., “an_interaction_id”) in the argument name.
Note: Please take the above code blocks as examples, as either the event or the payload can be quite different having more properties, or on the other hand just a couple of them.