Using Marketo Webhooks To Fetch Conversation Transcript

As you may already know, Drift's Marketo native integration has the capability to send custom activities to your Marketo instance. The "New Conversation Activity" includes the conversation transcript as part of its payload. For more information on this, you can visit the following link:

Marketo Integration - New Conversation Activity

In this guide, we will explain how you can sync the conversation transcript to a custom field in the Person object inside Marketo.



Because of Marketo limitations, this process will not work correctly when the conversation transcript includes emojis.

Step 1: Save the conversation ID

In our first step, we will capture the conversation ID and save it as a contact attribute in Drift. To achieve this, we need to add the following script below the Drift Widget installation snippet:

 window.drift.on("conversation:firstInteraction", function(data) {
     recent_conversationId: data.conversationId

This code will wait until the site visitor interacts with the bot, and it will store the conversationId as a custom attribute in Drift, recent_conversationId.

Step 2: Create custom fields in Marketo

We will need two new custom fields in Marketo, one for the recent_conversationId attribute and one that we will use to map the conversation transcript.

For the conversation ID the field needs to have the following settings:

For the conversation transcript, the field will have the following settings:

Step 3: Map the Conversation ID to Marketo

Now that we have saved the conversation ID as a Contact attribute and created a custom field in Marketo, we can proceed to the Marketo Integration page to map them together.

How to Map Attributes in Marketo



It is important to toggle the "On" option for the Overwrite feature so that we always end up with the most recent conversation ID in Marketo.

Step 4: Drift API Access Token

For the next step, you will need to obtain an API Access token. For detailed instructions, please refer to this guide.


App Scopes

This app requires conversation_read scope.

Step 5: Create Marketo Webhook

In Marketo, navigate to your Admin Settings, search for the Webhooks option and then click on New Webhook.

Use the following settings:

For the URL we are using Drift's conversation transcript endpoint:<conversationId>/transcript

We will replace <conversationId> with a Marketo token. This token will be our conversation ID field we create earlier.

Next, you will edit the Webhook Headers and add the Access Token as a Bearer token, like this:

Finally, we need to map the webhook response to the Conversation Transcript field we created earlier:

Step 6: Trigger your Webhook


Set up a Trigger

This step will depend on your preferred method of triggering the Transcript Fetcher Webhook. The following is just an example, but feel free to customize it according to your needs.

Webhooks can be called as part of Campaign Flows, you can add it like this:

The idea is to include some triggers so that the webhook is called only in specific scenarios, such as:

  • When a new Drift Conversation Activity is added
  • When a new Person is created
  • When a Person is updated

We recommend adding a filter to ensure that the webhook is only called when the Conversation ID field is not empty, in order to avoid any errors. In the end, your triggers may look similar to this: