Creating a ticket using the API

In this guide, we'll create a ticket with a WhatsApp customer.

The ticket model represents a conversation between multiple participants. Participants can send and receive messages from other participants (agents and customers) in the ticket.

Before sending any messages, you must first create a ticket. Usually, a ticket is created automatically when a customer sends a message, and he or she doesn't belong to any existing ticket(or any open ticket).

Every ticket contains participants, transactions(which are the messages), the owner(the agent whos responsible for the ticket)

Let's create a simple ticket using the API. We'll have to obtain an access token to use the API.

Send a POST request to the following URL:

https://app.glassix.com/api/v1.2/tickets/create

Do not forget to add the Authorization: Bearer <<access_token>> header

A ticket with a WhatsApp protocol customer named "Luke Long" with the number 7818469236. The number has to be in international format without a plus(+) sign.

Request body:

{
"field1": "Caribbean vacation",
"field2": "68 Colorado Way, RHYDCYMERAU",
"field3": "",
"field4": "",
"culture": "en-US",
"participants": [
{
"name": "Luke Long",
"protocolType": "WhatsApp",
"identifier": "7818469236",
"type": "Client"
}
],
"tags": [ "VIP" ],
"uniqueArgument": "JX867641"
}

We can also add messages directly to the ticket. This can be helpful if a customer fills a form on your website, and includes a message.

{
"field1": "Caribbean vacation",
"field2": "68 Colorado Way, RHYDCYMERAU",
"field3": "",
"field4": "",
"culture": "en-US",
"participants": [
{
"name": "Luke Long",
"protocolType": "WhatsApp",
"identifier": "7818469236",
"type": "Client"
}
],
"tags": [
"VIP"
],
"uniqueArgument": "JX867641",
"transactions": [
{
"fromParticipant": {
"identifier": "7818469236",
"type": "Client"
},
"text": "Hi, I wanted to contact you about a vacation in the Caribbean",
"type": "Message"
}
]
}


How did we do?

Powered by HelpDocs (opens in a new tab)