Table of Contents

Create a Ticket in Zendesk

Luis Trueba Updated by Luis Trueba

How to Create a ticket in Zendesk

In this article, we will explain how you can use Landbot to capture information and store it in Zendesk.

Create Ticket

  1. Set up questions blocks (name, phone, inquiry)

Each question will store the user input in a specific variable

it is required that when you create a ticket, you should have the user email:

  1. Now we will add the Webhook block, that we will use to create a ticket in Zendesk using its API:
  1. The first thing we need to set up in the Webhook block will be the Method, in this case, will be a POST

Prepend your Zendesk Support URL to the path to get the full endpoint URL. If example, if your Support URL is https://landbothelp.zendesk.com, then use the following endpoint URL:

You can copy from here:

/api/v2/tickets

Authorization

  1. Now we will add the Headers settings:

In the Key will be "Authorization"

To authenticate a request with basic authentication

Combine your email address and password with a colon.

Example:

jdoe@example.com:pa$$w0rd

Base64-encode the resulting string. You can do that on the following website:

https://www.base64encode.org/

Example:

amRvZUBleGFtcGxlLmNvbTpwYSQkdzByZA==

Include the base64-encoded string in an HTTP Authorization header as follows:

Authorization: Basic amRvZUBleGFtcGxlLmNvbTpwYSQkdzByZA==

The example uses basic authentication requiring a Zendesk username and password. Make sure to enable password access in the Admin Center interface at Apps and integrations > APIs > Zendesk API.

Make sure you click on the Enabled button.

Request format

The Zendesk API is a JSON API. You must supply a Content-Type: application/json header in PUT, POST, and DELETE requests. You must set an Accept: application/json header on all requests. You may get a text/plain response in case of an error like a bad request. You should treat this as an error you need to fix.

Customize the Body

Now we will select to Customize the Body of the request. You can specify a requester when creating a ticket. A name, email, and locale id can be set for the requester. A name and email are required. For locale ids, see the Locales API.

Here is the JSON:

{
"ticket": {
"subject": "Landbot",
"comment": {
"body": "@inquiry"
},
"requester": {
"locale_id": 1,
"name": "@name",
"email": "@email"
}
}
}

We will add the JSON:

As you can see, we map the variables in Landbot that we are storing in the blocks before the webhook, and map them to properties in Zendesk. You can add as many as you need, but bear in mind that such properties must exist in Zendesk.

Also, you will need to match the variable @name with the property "name"

And always make this request with the email

  1. We need to make sure everything is set correctly, to do this, we will make a test with some data that we will use to create a ticket in Zendesk for testing.

Here we fill the variables, with some values:

  1. Press test check response

And the response from this test will be displayed below:

And if we check in Zendesk the test has been successful creating a new ticket:

How did we do?

Zendesk Integration Dashboard

Contact