Create a Ticket via Intercom API

Tickets are a convenient way to capture and track complex customer queries in Intercom, so a lot of popular Ticket usecases are related to Customer Support.

However, Tickets can also be helpful for other teams in Intercom, to do things like track escalations or operational tasks.

For example, if you have identified some sort of user behaviour where you would want to intervene and reach out to the customer, Tickets can be useful.

A usecase we've heard from early adopters of tickets is creating follow up items for Sales teams monitoring the progress of leads and prospects through trials of your product. You might have some customers that are considered "high-value" in your system, and the definition of high value varies from business to business. You might have also noticed that a certain percentage of these high value customers don't complete your onboarding flow, so you need an easy way for your Sales team to proactively reach out to these clients and make sure they complete onboarding.

Tickets make this possible.

Step 1: Create a ticket type

First, you'll need to create a ticket type called "Onboarding" that would act as a template for all of the future tickets of this type:

curl --request POST \
     --url https://api.intercom.io/ticket_types \
     --header 'Intercom-Version: 2.9' \
     --header 'accept: application/json' \
     --header 'authorization: Bearer <Your access token>' \
     --header 'content-type: application/json' \
     --data '
{
  "icon": "๐ŸŽŸ๏ธ",
  "is_internal": true,
  "name": "Onboarding"
}
'

Second, you'll need to create attributes for this ticket type, i.e. the data fields to be captured in tickets created for users who don't complete onboarding. In this tutorial, we will create just one attribute to track the priority of the ticket, but you may choose to create multiple attributes specific to your business:

curl --request POST \
     --url https://api.intercom.io/ticket_types/1/attributes \
     --header 'Intercom-Version: 2.9' \
     --header 'accept: application/json' \
     --header 'authorization: Bearer <Your access token>' \
     --header 'content-type: application/json' \
     --data '
{
  "required_to_create": true,
  "required_to_create_for_contacts": false,
  "visible_on_create": true,
  "visible_to_contacts": false,
  "name": "Priority",
  "data_type": "list",
  "list_items": "P1, P2, P3"
}
'

This is what such a ticket type could look like:

Onboarding ticket type

This tutorial assumes that this is the only ticket type you have in your system.

โ—๏ธ

You can't create a ticket without first creating a corresponding Ticket Type. You'll only need to do this once.

Step 2: Create a ticket

To create a ticket in Intercom, you need to make a call to Tickets API :

curl --request POST \
     --url https://api.intercom.io/tickets \
     --header 'Intercom-Version: 2.9' \
     --header 'accept: application/json' \
     --header 'authorization: Bearer <Your access token>' \
     --header 'content-type: application/json' \
     --data '
{
  "contacts": [
    {
      "email": "[email protected]"
    }
  ],
  "ticket_attributes": {
    "priority": "1",
    "company_size": "100",
  },
  "ticket_type_id": "1",
}
'

๐Ÿ“˜

You can use our interactive API playground to create a new Ticket, directly from the reference docs, using Node, Ruby, PHP, Java, Python and other languages. You can also use reference docs to learn about each data field you can send to the API.

Once the ticket is created, you may also choose to assign it to a specific person or team by making an update to the ticket via the API. This can be your Sales team, whose task it will be to reach out to the affected customer and help them complete the onboarding.

๐Ÿ‘

You can also create an Inbox rule that will auto assign a ticket to a specific team based on a ticket type.

We hope that this tutorial gives you some ideas about how your business can benefit from Intercom tickets.

Next steps