Category
|
#webhook #application #workflow #automation
|
Objective
Allow external applications to be able to subscribe to iAdvize events (via callback urls) to receive real-time updates and trigger an automated workflow.
What do I need
- Create an iAdvize application
- Subscribe to the webhook of your choice
- Create a workflow with an application to trigger the desired action
Use case
- Sending an email at the end of a conversation
- Sending a promo code at the end of a conversation
- Capture a lead or enrich a lead
- Sending a survey at the end of a conversation
- Dashboard monitoring of CSAT in real-time
- Create a ticket in an external system
Steps to follow
Prerequisite: identify which event should trigger the action you want to implement.
Examples:
- conversation.started
- v2.conversation.pushed
- v2.conversation.closed
- visitor.updated
- satisfaction.answered
STEP 1: Subscribe to a Webhook event (e.g. conversation closed)
- Create an account or log in to the developers’ platform
- Create your application
- Subscribe to the webhook of your choice
- Install your application in the iAdvize marketplace section:
Payload example
V2.conversation.closed
{
"eventId": "0f0bb3af-5035-4ba3-b3fb-ff4879a3a74d",
"eventType": "v2.conversation.closed",
"platform": "ha",
"projectId": 1549,
"clientId": 335,
"conversationId": "4c8c7408-f73c-42cd-89e9-afbbee7d9024",
"operatorIds": [
15253,
15254
],
"visitorExternalId": "63429889", // deprecated. Only available for ONSITE conversations. Use `visitorId` field instead.
"channel": "CHAT", "visitorId": "b05f1b45-c891-4a9c-b47e-91ee6c8ffb44", "createdAt": "2019-04-12T07:58:35.171Z",
"sentAt": "2019-04-12T07:58:35.496Z"
}
STEP 2: Trigger a REST/GraphQL API query to retrieve the desired data (email, CSAT, conversation content....)
In this step, we will retrieve the visitor's email via the REST API using the contact ID retrieved in step 1.
- Make an HTTP "GET" query by specifying the URL of the resource (visitor) that we want to retrieve and the ID (contact) of which we want the details GET /visitor/560.
- Check the email field
STEP 3: Trigger the desired action with the tool of your choice (send an email, create a dashboard, create a lead in your CRM...)
Diagram