Create a Ticket in Intercom

Abby Updated by Abby

This article will explain how we can create tickets in Intercom, directly from the Landbot flow

The process is fairly simple, but requires that you first create the contact in Intercom

This is what the flow will look like:

As we covered up until the 'Next step in flow' block in the previous article, we will now just need to add a webhook to create the conversation

This will be a POST to the following url: https://api.intercom.io/conversations

In Headers we will use the same Authorization and Content-Type as we used previously

Now in the BODY of the request we will include the following:

{
"message_type": "email",
"subject": "@name is requesting support",
"from": {
"type": "user",
"id": "@intercom_id"
},
"body": "@text"
}

The subject can be whatever you would like, this is what you'll see in Intercom at first glance

The Intercom ID will come from the 'Create Lead' webhook

And the variable @text will come from our 'Question: Text' block, however, you can use anything here

Now, let's test the request!

After the test, from the purple dropdown, we'll select conversation_id, we will save this for later

This is what we will see in Intercom:

OPTIONAL: Assign ticket to inbox

We can optionally create some conditions, and based on the question the user is asking, assign the conversation to an inbox in Intercom

We will need the Admin ID, as well as the ID of the inbox, you can find the Inbox ID at the end of the Inbox URL

We will need another webhook for this, as the Headers are the same, the easiest will be to copy the previous webhook

We'll change the url to the following: https://api.intercom.io/conversations/@{conversation_id}/parts

The conversation ID will come from the previous webhook

In the body we'll add the following:

{
"type": "team",
"admin_id": "xxx",
"assignee_id": "4570062",
"message_type": "assignment"
}

You will need to replace the admin ID for your own admin ID, and the assignee ID will be the one from the inbox we've selected

And that's it! The ticket should automatically be assigned to the inbox

How did we do?

Create Contacts in Intercom

Contact