As discussed in our article about our Engagement Builder Webhook, we have a feature not only to send a webhook after an event (like a call ending), but we also have the capability to trigger events, like sms or emails or even another webhook, after a custom event is received (an inbound webhook).
There are some requirements needed to set this up, let's have a look.
Prerequisites
An API Key is required for the authentication header to be able to send an inbound Webhook to Kaisa. You can create a key for our v3 API in Settings in our Dashboard. See below:
And from there you can click on API keys and create one:
When you create the Key, the right Scopes need to be added. You need to select:
ACCOUNTS_READ
WORKFLOWS_CUSTOM_TRIGGER
NOTE: If you don't see the Workflows Custom Trigger Scope in the list, it means your user doesn't have this Scope linked to it just yet. Don't worry, we can fix that for you, please send an email to support@kaisa.io and we'll get that sorted.
IMPORTANT: You only get one chance of seeing the key, so remember to store it in a secure place that you can access later.
Sending an Inbound Webhook to Kaisa
Once you are setup, you can send a POST request to our v3 endpoint /workflows/custom
You need to provide:
Authorization
header - use the API key that you created in our platformexternalAccountId
- this is the account's ID, referred to as custnr in our platform. You can find this id in Settings for an account in "Classic Freespee", or using our Customers API resource covered in our Developer Site here.articleId
- An article ID referencing an article in the attribution API. This can be an event Id (for example, an appointment ID). Can be hardcoded to a generic value.payload
- your own data structure to be used for criteria and macros.- Tip: Provide an “eventName” in the JSON root to be able to filter workflows on specific events!
cURL example:
curl -X 'POST' \
'https://api.kaisa.io/workflows/custom' \
-H 'accept: application/json' \
-H 'Authorization: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx' \
-H 'Content-Type: application/json' \
-d '{
"externalAccountId": "yourCustNrHere",
"articleId": "booking1234",
"payload": {
"eventName": "testdrive",
"name": "John Doe",
"financeOption": "yes"
}
}'
We have Swagger documentation including a testing function, here: https://api.kaisa.io/docs/#/workflows/WorkflowsController_triggerCustomEvent
Using payload data in workflows and messages
Once the webhook is setup and received, you can use the parameters in the Payload in the Delivery method (the action to be taken after the inbound webhook is received, for example sending another webhook or sending an email).
You can add parameters from the Payload in the Delivery Method, using the known parameters included in the inbound webhook. For example, using the parameters from the cURL example above:
Using inbound parameters as Criteria
You could also use the parameters sent in the inbound webhook as criteria to trigger the Delivery Method (for example, send an email only if the finance option is Yes).
To be able to see these as the Criteria options in the Engagement Builder, you need to contact our Support team in support@kaisa.io so we can add this in our end for you.
Any questions feel free to ask in a comment in this article or contacting our team.
Comments
0 comments
Please sign in to leave a comment.