Your first Drift Conversation Bot

For many businesses, Drift can be the first line of communication with a potential customer.

In your use of Drift, you may have come across a need for custom external workflows and integrations with other applications. Drift has a number of prebuilt applications, such native integrations with Salesforce as well as Zapier hooks, but if none of the current features precisely fit, we also have an API to empower you to build!

In this example, I’ll go through the process of creating an external drift application that listens in on messages within the Drift conversations view will define words when the agent enters a certain trigger phrase. I have called this app Definely.

The source code is available on github:, though you can follow along without viewing this. I’ll also mention here that the core bot source code is under 100 lines!

The Drift API

Creating a new App

From here create a new application:

Creating a new drift application

Once you log in, you’ll want to define the title and description/goal for the app, as well as a logo. For our app, I created a simple logo for definely which will show up on the apps page within Drift.

We’re all set! We can now install to drift, click here to install app to your organization’s account.

Installing the Drift App to your org

After clicking this, your app token will be revealed. This will be used by the server to authenticate requests into the drift message api.

Now, if you’re following along fully, I would recommend downloading the Definely app source code and starting the server (after following the readme)— the server will run locally on port 3001 by default.

For testing, I recommend exposing this for interaction with Drift via the tool ngrok:

You can now expose your local server with the following ngrok command.

./ngrok http 3001

Take the public url of the form and plug into the event field — appending /api to this url as the callback route. Also be sure to set the event subscription to new_message as shown below.

Setting the callback url

Once the event subscription and callback urls are defined, you will need to add auth scopes to the app to be able to read and write to conversations. This is shown below.

If everything worked successfully, you should see your app and “Connected” visible in the My Apps view back from the main drift console.

We made an App!

Navigate to a live conversation and try it out! This is now active for your organization!

Definely in Action!

Wrapping Up

Next Steps:

Exposing your app to other users

For a public app to be accepted, it will need to meet higher quality standards and be available on either a remote server or a service such as AWS lambda (and not ngrok unfortunately), we’ll review all apps that get submitted to us.

I won’t go into detail here on submission, but the submission process is well described in our docs:

Revisiting the App Source code

Joining our Dev Slack

Let us know what you build or if you have any questions!

Other Examples:

Insert shareable gifs into the conversation view

Translate messages in the conversations view

Happy Drifting.




Building things @Stavvy

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store