Skip to main content
Gainsight Inc.

Create Zendesk Tickets from Call External API Action Type

This article explains how to automate the process of creating Zendesk tickets, by using the Call External API Action Type. 

Overview

This tutorial explains how to create a Zendesk Ticket from Rules Engine. It is assumed that all the Zendesk ticket data is stored in a CSV file, hosted on an S3 Dataset. An S3 Dataset would be created to fetch the CSV details. The CSV file has two columns Issue and Description of the issue. The API would create two fields Issue and Description. The values of the CSV column would be ingested into the fields created by the API. Values of this column would be ingested into the fields created by the API.  The value in these fields would be configured from Rule dataset, and would vary for each ticket created.

This tutorial has three steps:

  1. Configure Custom Connector
  2. Setup External Action
  3. Configure Call External API Action

This section explains how to create a connection to Zendesk. 

To use custom Connections: 

  1. Navigate to Administration > Connectors 2.0.
  2. Click Custom Connector.
  3. Click Create Connection. The Create a Connection window is displayed.

Create connection.GIF

  1. Enter a name for your Slack connection.
  2. Select the Authorization Type as Basic
  3. Enter your Zendesk credentials. 
  4. Enter the GET URL of your Zendesk account. 
  5. Click TEST CONNECTION to test your connection. 
  6. (Optional) Enter a description.
  7. Click CREATE.

aqwes.GIF

Setup External Action

This section explains how to create an action for the Zendesk Connection created in the previous section. The action you create here can be used in Rules Engine under the Call External API action type. In this section, two fields called Issue and Description will be created. The value for these fields will be populated from the Call External API action when the Zendesk ticket is created. 

To access the External Actions page:

  1. Navigate to Administration > External Actions
  2. Click Create Action. The Action creation page has five sections.

eqa.GIF

Basic Information

In this section, you can configure the following fields:

  1. Select the Zendesk connection(?) created in the previous section from the Select a Connector drop-down menu.
  2. Enter a name for the action in the Action Name field. 
  3. Enter the POST URL of the Zendesk account to which you wish to create new tickets. The URL shown below is for a test Zendesk account and would vary for you. To learn more about  Zendesk POST API to create tickets, refer to the Create Tickets section of the Zendesk Developers article.

cnncrt.GIF

Payload

In this section, configure the fields in JSON format. These fields are displayed under the Setup Action page and you can load data from a Dataset into these fields. Payload can be entered either in the JSON format or x-www-form-urlencoded format.

In the following image, the Payload fields are added in JSON format.

test.GIF

The code

{"ticket": {"subject": "{{Issue}}", "comment": { "body": "{{Description}}" }}} 

creates a Zendesk ticket. The title of the ticket can be configured from the Issue field and the description of the ticket from the Description field. The two fields are created from API and values can be ingested into these fields from Call External API action in Rules engine. 

To learn more about Create Ticket API in Zendesk, refer to the Zendesk Tickets API document. 

Headers Information

In this section, you can configure the Key-value pairs. By default, the Content-Type: application/JSON value is present. Do not alter this value. Click + to create additional Key-value pairs.

headers.png

Fields

In this section, configure the data type for the fields created in the payload section. In this example, the default String Data type is retained.

field.GIF

Advanced Configuration Information

In this section, you can configure the maximum number of times the API should try to reconnect to Zendesk, in case a connection is not established. By default, this value is set to 3.

lk.png

Click Create to create the action.

ds.png

You can test the action by using the Test option.

extrnal.GIF

The API response code 201 indicates that a new ticket was successfully created.

Configure Call External API Action

This section explains how to leverage the Call External API action, by using the connection and action created above. 

To use the Call External API action Type: 

  1. Create a rule. In this example, it is assumed that all the issues reside in a CSV file, stored in an S3 dataset. The CSV file has two columns; Issue and Issue description. The values of these columns would be ingested into the fields, populated from the API.
  2. Navigate to the Setup Action screen. 
  3. Click + ACTION.
  4. Select the Call External API action type. 
  5. From the External API drop-down menu, select the action (Create ticket in this example) created in the previous section. This action is present under the Connection name (Zendesk in this example).

aqw.GIF

  1. The Issue and Description are populated from the External Action screen.

vc.png

  1. Choose values from your dataset to insert into these fields. You can also choose to insert custom values instead of mapping fields from the dataset.

iu.GIF

You can also choose to ingest custom values into the fields. 

  1. Click SAVE.

desc.GIF

When you execute the rule, a new ticket is created in Zendesk with Title Gainsight Issue and comment as A New issue created.

zendesk.GIF

The ticket is assigned to the user whose credentials were used to establish a connection to Zendesk (refer to the Configure Custom connector section of this article). This user also receives an email that confirms the creation of the ticket.

aq.png

 

  • Was this article helpful?