Zapier and Drift - Custom Webhook Configuration
Overview
Drift customers know that webhooks are a powerful way to capture data server-side and send insights about Conversations, Contacts, Chat Users, Meetings, and Playbook Goals to third party applications. Platforms like Zapier create a simple, "no-code" approach to configuring Drift Webhooks to send information to external systems like an events stream or a data warehouse, or a marketing automation or CRM platform not otherwise supported by a native integration.
Problem
Although Zapier has pre-built Drift events that are designed to capture conversation and playbook outcomes, some customers have found that these out-of-the-box steps create duplicate leads in their external systems, or fail to capture 100% of the triggered Drift Events. They are also constrained to a small list of pre-configured webhooks, whereas Drift has 20 unique events that can be tracked server-side.
Solution
Using Zapier's Premium "custom webhooks" feature, you can combine a series of "Catch Hook" and "GET" steps to consume all the necessary Drift information needed to create a bespoke integration without writing any code!
Step 1 - Configure Drift Developer Application
Follow our trusty guide to creating a Drift application in order to create a Drift Bearer Token with the following scopes:
Step 2 - Create a new Zap
Now that you have your bearer token, open up Zapier and create a new Zap that catches a hook:
Copy the HTTPS:// endpoint URL that is automatically generated out of Zapier to paste into your Drift Developer application you created in Step 1:
Make sure to double check the formatting of the URL looks correct, and to ensure you have selected the 'conversation_push' webhook from the dropdown at the bottom of this page:
Info:
At this step you can push the 'Send Test Payload' button in Drift to send an empty JSON to Zapier to confirm correct implementation.
In order to move forward you will need to start and then close a new chat as a website visitor so that Zapier can consume live conversation data to proceed with the next steps. Without actual conversation data passed to Zapier, we will be unable to retrieve the rest of the pieces needed to send information to third-party integrations.
Step 3 - Catch a Drift Webhook to Gather Test Data
Now that you have created a flow of data from Drift to Zapier and provisioned a Bearer Token that can retrieve data from Drift, it is time to start pulling information in about the Conversation, the Contact, and any related Participants.
Note:
For more details on what data can be retrieved from each related Drift object, check out the associated Conversation, Contact, and User models linked in the lefthand sidebar of our DevDocs.
Step 4 - GET Conversation by ID
The first step is to retrieve the conversation using the unique numeric ID shared in the conversation_push webhook:
In order to access the Conversations endpoint, you will need to configure Zapier to declare the Bearer Token created in Step 1 in the message Header. The format is "authorization" in the header field, and then "bearer (space) $token_value" as seen below. We will need to reproduce this step exactly in each subsequent GET request made to Drift's APIs so that Zapier can retrieve the needed data with proper authorization:
Warning:
If you do not properly configure your bearer token to have scopes for Contact Read, Conversation Read, and User Read, you will be unable to retrieve data from Drift's API. Please verify you followed all of the steps for creating and assigning proper scopes when setting up this Developer Application
The Conversation Model will contain the following information that we will use to continue gathering required data for passing to third-party integrations.
Step 5 - GET Contacts by Unique ID
Once the Conversation Model is retrieved, we will have an ID to use to GET the contact attributes related to the visitor:
Step 6 - GET the Details About the Chat User aka "Participant"
In order to preserve any conversation or lead ownership that was established in chat, it can be helpful to retrieve data about the Drift Participant using our User Model. This allows you to map the chat teammate's name, email, phone, and display name or alias. These details can be used to understand who should be the Lead Owner in subsequent systems, so the person who was routed in chat or had a meeting booked can follow up appropriately after the conversation closes:
Step 7 - GET the Transcript from the Conversation
Now that we have all the user details we need to create a new lead, we may also want to gather the transcript from the conversation to share for context and to support internal teams taking the right next step to follow up with the website visitor. You can make a very similar API call as was used to retrieve the conversation model, only add "json_transcript" to the end in order to pull back this additional data:
Conclusion
At this step in the workflow, Zapier has collected data about the Conversation, its Transcript, the Contact data from the visitor from chat, and the email identity of the teammate who was routed or had their calendar booked. This provides the basic starting point to create and update leads or accounts, share custom activities about conversations, and segment conversation data by conversation Tags or keywords in transcript-bodies.
There are additional steps which can be configured for capturing the new_meeting webhook, and also using platforms like Zapier to gather detail about these booked meetings. Check out our developer document about the Meeting Model for more details on including this custom webhook workflow into your implementation of Drift and Zapier!
Updated over 2 years ago
For more insights on working with Drift's data models, check out this Developer Document about creating a custom CRM or MAP integration using Drift Webhooks!