1. Help Center
  2. Webhooks & Integrations
  3. Introduction to Webhook Templates

Creating a ticket in Zendesk Support

When an end user is chatting with your bot outside opening hours, it can be useful to design a flow that allows them to leave a message. That way, the human agents may respond to user requests when they are next available.

If you have a Zendesk Support subscription, we recommend using our wh_iconZendesk Support Create Ticket Webhook Template, which will be described below. If you do not have a Zendesk Support subscription, we recommend using our wh_iconCertainly Dynamic Email Notification Webhook Template.

In this article, we'll share a helpful video, then we'll focus on the most common configurations of the wh_iconZendesk Support Create Ticket Webhook Template:

Video tutorial

For a step-by-step approach to ticket creation in Zendesk Support, please refer to the following video:

Standard configuration of the example body

As can be seen below, we include a few Custom Variables like , , and . These custom variables should be seen as a storage location for data either collected from the end user reply to a given Module or defined by the Bot Operator as a fixed value. For the purposes of this article, we will be storing the end user replies in these three Custom Variables.

js
{
"request": {
"requester": {
"name": "",
"email": ""
},
"subject" : "Ticket automatically created from Certainly",
"priority" : "normal",
"type" : "task",
"comment": {
"body": ""
}
}
}

To take as an example, you can see in the following screenshot that we are asking the end user for their name, and we're activating the "Store End User Reply in a Custom Variable" function and setting the variable name to "userName".

screenshot-me.botxo.co-2020.06.06-01_42_47.png

Once the end user provides a response to this Module, their response will be saved inside the "userName" variable. 

In the following screenshot, you can see that the end user has written their name as "John Doe", and that this data is stored in the Custom Variable . When the Webhook is fired, we are automatically filling the custom variables with the values collected in the conversation.

ticketcreation.png
There are many other properties that you can include in this request, some of which are illustrated below.

Customizing the example body

Below, we will provide information about customizing the example body, covering:

Tags

Tags must be placed within an array (square brackets), as you can see below:

js
{
"request": {
"requester": {
"name": "",
"email": ""
},
"subject" : "Ticket automatically created from Certainly",
"priority" : "normal",
"type" : "task",
"tags": ["tag1", "tag2"],
"comment": {
"body": ""
}
}
}

You can also use Custom Variables to make the tags dynamic through the use of the Store End User Reply in a Custom Variable function, illustrated here:

js
{
"request": {
"requester": {
"name": "",
"email": ""
},
"subject" : "Ticket automatically created from Certainly",
"priority" : "normal",
"type" : "task",
"tags": ["", ""],
"comment": {
"body": ""
}
}
}

Custom fields

In the example that follows, we're filling the custom field with the ID "360007562940" with the value "reset_password". You can use this code snippet (marked in bold) to set the value for any ticket field:

js
{
"request": {
"requester": {
"name": "",
"email": ""
},
"subject" : "Ticket automatically created from Certainly",
"priority" : "normal",
"type" : "task",
"custom_fields": [{"id": 360007562940, "value": "reset_password"}],
"comment": {
"body": ""
}
}
}

If you want to create a field of your own, you can navigate to the following URL (note: replace "{your_subdomain}" with the name of your own Zendesk subdomain): https://{your_subdomain}.zendesk.com/agent/admin/ticket_fields

Depending on the type of the specific custom field you're setting a value for, you may see some tags being created automatically as a result of your Webhook. The three types of custom fields that add tags are the "drop-down list", the "checkbox", and the "multi-select" fields.

For more information about the different types of custom fields, please refer to Zendesk's documentation on setting custom field values.

Ticket form

Enterprise-level Zendesk Support subscription required

If you have multiple ticket forms on your Zendesk environment, we recommend setting the specific ticket_form_id in the body of the Create Ticket Webhook. 

js
{
"request": {
"requester": {
"name": "",
"email": ""
},
"subject" : "Ticket automatically created from Certainly",
"priority" : "normal",
"type" : "task",
"ticket_form_id": "360003653593",
"comment": {
"body": ""
}
}
}

You can find the IDs of your ticket forms at https://{your_subdomain}.zendesk.com/agent/admin/ticket_forms (replace "{your_subdomain}" with the name of your Zendesk subdomain).