# How to Create Ticket using Generic Channel

After making the channel, please try creating a ticket to confirm that it's working properly. You can create a ticket using generic channels via the provided API. Simply follow these steps to make a generic ticket:

First, you must authorize to get a token that be used to create tickets. Next, after received the token, you can create a ticket using the API available for generic channel.&#x20;

## Create Token

<mark style="color:green;">`POST`</mark> `{channelURLonlyuntilport}/oauth/token`

This is how you get tokens before you can make geeric tickets.

Authorization

| Name     | Value         |
| -------- | ------------- |
| Username | Client id     |
| Password | Client secret |

<figure><img src="https://765826444-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYDAnLjpg2T8z2BplJOS%2Fuploads%2F3EzJ9xieBtPEF3WZAakh%2Fclient%20id%20client%20secret%20channel%20edit.jpg?alt=media&#x26;token=8e96fbb2-0c09-4ecb-b216-b063e9d3c7f6" alt=""><figcaption><p>Client id and client secret on Channel Connector</p></figcaption></figure>

<figure><img src="https://765826444-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYDAnLjpg2T8z2BplJOS%2Fuploads%2FcJtrFsJilpnwHdHNflgr%2FAPI%20oauth%20generic%20authorization%20edit.png?alt=media&#x26;token=051c8350-7e78-442c-9be7-7a4d7aa06df2" alt=""><figcaption><p>Authorization </p></figcaption></figure>

**Body**

| Name         | Value         |
| ------------ | ------------- |
| `grant_type` | password      |
| `username`   | Client id     |
| `password`   | Client secret |

<figure><img src="https://765826444-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYDAnLjpg2T8z2BplJOS%2Fuploads%2FmYTjdAeMv4k1Pv733gAw%2FAPI%20oauth%20generic%20edit.jpg?alt=media&#x26;token=092d9e82-9dad-419c-ac08-1d6ef93010b2" alt=""><figcaption><p>Body Request</p></figcaption></figure>

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
  "access_token": "token",
    "token_type": "bearer",
    "expires_in": 86399,
    "scope": "read write"
}
```

{% endtab %}

{% tab title="401" %}

```json
<UnauthorizedException>
    <error>unauthorized</error>
    <error_description>Full authentication is required to access this resource</error_description>
</UnauthorizedException>
```

{% endtab %}
{% endtabs %}

## Create Generic Ticket

<mark style="color:green;">`POST`</mark> `{Channel URL}`

This is used to create tickets through generic channels.

**Headers**

| Name          | Value            |
| ------------- | ---------------- |
| Authorization | `Bearer <token>` |

**Body**

{% hint style="info" %}
The request body fields are aligned with the mapping fields in the created generic channel.
{% endhint %}

Below is an example of a body request that has been agreed as a mapping field available in the 3Dolphins application.

<table><thead><tr><th width="230">Name</th><th width="109">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>contact_first_name</code></td><td>string</td><td>This field is intended for storing the customer's first name</td></tr><tr><td><code>contact_last_name</code></td><td>string</td><td>This field is intended for storing the customer's last name</td></tr><tr><td><code>contact_email</code></td><td>string</td><td>This field is intended for storing the customer's email address</td></tr><tr><td><code>phones</code></td><td>string</td><td>This field is intended for storing the customer's phone number</td></tr><tr><td><code>message</code></td><td>string</td><td>This field is intended for storing the customer's message</td></tr><tr><td><code>ticket_number</code></td><td>string</td><td>This field contains the ticket number for customer interactions.</td></tr><tr><td><code>account_id</code></td><td>string</td><td>This field contains the unique identification number to each customer account.</td></tr><tr><td><code>dolphin.contact.id</code></td><td>string</td><td>This field supports for the mapping between the external contact ID and the 3Dolphins contact ID.</td></tr></tbody></table>

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
}
```

{% endtab %}
{% endtabs %}

<figure><img src="https://765826444-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYDAnLjpg2T8z2BplJOS%2Fuploads%2FoE7r3fV5XFGkAdNHepn6%2FUnassigned%20Ticket.png?alt=media&#x26;token=57066848-6e37-42ce-9ee7-799f3ba8a5b0" alt=""><figcaption><p>Create Generic Ticket</p></figcaption></figure>
