Skip to content

Ticket

Ticket creation

To perform an integration that creates a ticket, you must send a request with the following structure:

1
2
3
POST https://queue-api.obmessage.ai/api/v1/tickets
X-Api-Key: {{API_KEY}}
Content-Type: application/json
1
2
3
4
5
6
7
8
{
    "topic_id": string,
    "data": {
        "id": int,
        "name": string,
        "lastname": string
    }
}

Example

1
2
3
4
5
6
7
8
{
    "topic_id": "519ac790-85cd-411e-b744-d21d83f21178",
    "data": {
        "id": 1,
        "name": "Juan",
        "lastname": "Pérez"
    }
}

Result when creating the ticket

When the result is 200 OK, the response has the following structure:

1
2
3
4
5
6
7
8
9
{
    "id": uuid,
    "topic_id": uuid,
    "status_id": int,
    "ticket_number": string,
    "sla_minutes": int,
    "priority": int,
    "created_at": utc-date
}

If the topic used has the with_turn option set to true, a turn will also be generated when the ticket is created. In that case, the result will have the following structure:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
{
    "id": uuid,
    "topic_id": uuid,
    "status_id": int,
    "ticket_number": string,
    "turn": {
        "id": int,
        "created_at": utc-date,
        "attention_date": date,
        "start_hour": string(time: hh:mm:ss),
        "end_hour": string(time: hh:mm:ss),
        "code": string
    },
    "sla_minutes": 60,
    "priority": 1,
    "created_at": "2024-07-29T13:56:20.58197239Z"
}

Field description

Field Type Description Required / Default value
topic_id uuid ID of the topic from which the ticket will be created.
status_id int Parent status of the ticket. The topic’s status_default is used. If the topic does not have a default status, this field is required.
customer_status_id int Customer status of the ticket. The topic’s status_default is used. If the topic does not have a default status, the value will be null.
assigned_user_id uuid ID of the user to whom the ticket will be assigned.
sla_minutes int Ticket SLA value. If not sent, the topic’s sla_minutes value is used.
priority int Ticket priority. Allowed range: [1-10]. The default value is 1. If not sent, the topic’s default_priority value is used.
comment string Comments associated with the ticket.
attachments []JSON Files attached to the ticket. The ID of the file registered in the fileserver must be sent.
data JSON Set of data associated with the ticket. This data is displayed according to the configured template.
turn_id int ID of the turn that will be used to copy the code when the ticket turn is generated.
attention_date string Service date on which the turn will be handled, in yyyy-mm-dd format. datetime.NOW
bot_script_id_success int Aless integration: ID of the script to which the bot should jump if the ticket is created successfully.
bot_script_id_failed int Aless integration: ID of the script to which the bot should jump if an error occurs while creating the ticket.

Errors when creating the ticket

If the topic used is outside the configured schedule, the following error is returned:

1
2
3
4
{
    "code": "error.invalid_reference",
    "message": "error creating ticket: 'no schedules or turn'"
}

Try it in Postman