Conversations are the beating heart of Drift.
While you may already be passing conversation data to your MAP or CRM, you may want to export this data to an unsupported platform or take it to your BI tools for archival or analysis purposes. To that end, we’re going to walk through how to get started with Drift’s API to export conversation data.
First and foremost, Drift does not have a bulk export functionality for all conversation data. (Mostly for performance considerations.) The first thing we’re going to want to do is gather the conversation IDs for the conversations we want to export. There are two major ways to get these.
Option 1: Establish a live stream of data.
In order to gather conversation data in real time (like our native integrations), we will want to start with the Conversation_Push webhook which will broadcast any time a conversation closes or is otherwise complete and ready to be synced. This webhook payload will contain your conversation ID. Listening to this webhook means you can collect these IDs in real time and begin to process them immediately to get your conversation data.
Option 2: List conversations.
You can gather your recent conversations using the Conversation List endpoint. This endpoint will return your conversations paginated and chronologically by most recently updated. This option is not quite as performant as the live stream, but it should get you the conversation IDs you need to take onto the next step.
Once we have our conversation IDs, we can move onto actually gathering the data we need.
Each ID will be the key identifier for pulling the conversation’s data. With these IDs, you’ll need to loop over the endpoints that hold the data until you have pulled everything you need.
First, our Conversations endpoint will get you context about the conversation, including who was involved and how the conversation was tagged. This endpoint will also return the Contact ID of the individual you’re chatting with so you can pull contact level data as well after retrieving the conversation context.
Then, if you need a transcript, you can use our Transcript endpoint or you can use our Messages endpoint to retrieve the messages one by one to construct your own. If the conversation has attachments you need access to, there’s an endpoint for that too! Lastly, if you are pulling the related Playbook or User IDs, you may want to translate them from their backend numerical ID to something more legible via the Playbook and User APIs.
Then, repeat your preferred process for every conversation you’d like to export. If you’d like to discuss further, please reach out to your Customer Success Manager about working with Drift’s Professional Services Engineers.
Updated about 1 year ago