# Bot API

O bot API é um serviço que permite iniciar atendimentos com integração por meio de uma API.&#x20;

## Configurações

Adicione uma nova API com as seguintes informações:

![](https://776911411-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MBjaNm5lB1Yqgih1JCA%2F-MRyU_ysnFPOzG4NZhUV%2F-MRyV8m8MuRFFYyOr437%2Fimage.png?alt=media\&token=df3493e7-3dec-4f4f-9573-51e151e3af48)

* **Nome:** nome que deseja para a API
* **Assistente:** selecione o assistente >adicionar o link da página de assistentes da doc<
* **Squad:** selecione o nome da squad se estiver disponível na lista, caso contrário mantenha como “geral”

Após criar, acesse sua área de edição para configurar algumas opções:

![](https://776911411-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MBjaNm5lB1Yqgih1JCA%2F-MRyU_ysnFPOzG4NZhUV%2F-MRyVlwDISy6xfRlz57_%2Fimage.png?alt=media\&token=eabc647c-b206-44f9-99c3-df6cc67454fa)

O processo assíncrono é utilizado na V2, nesta temos a possibilidade de configurar um callback, que é o endpoint informado na tela de configuração da API que irá receber a resposta do assistente após uma requisição com input.

<mark style="color:green;">`POST`</mark> `https://connector.ms.altubots.com/<slug>/api/<id_integracao>`

#### Headers

| Name                                            | Type   | Description      |
| ----------------------------------------------- | ------ | ---------------- |
| Content-Type:<mark style="color:red;">\*</mark> | string | application/json |

#### Request Body

| Name                                            | Type   | Description          |
| ----------------------------------------------- | ------ | -------------------- |
| Authorization<mark style="color:red;">\*</mark> | string | token gerado no ALTU |

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

```
{
    "code": 200,
    "message": "Message sent."
}
```

{% endtab %}

{% tab title="400 " %}

```
{
    "code": 400,
    "message": "Bad request: body"
}
```

{% endtab %}

{% tab title="401 " %}

```
{
    "code": 401,
    "message": "Unauthorized."
}
```

{% endtab %}

{% tab title="404 " %}

```
{
    "code": 404,
    "message": "Client not found."
}
```

{% endtab %}

{% tab title="500 " %}

```
{
    "code": 500,
    "message": "Unexpected Error."
}
```

{% endtab %}
{% endtabs %}

#### **Body:**

```
{
    "input": {
        "text": "Olá"
    },
    "identifier": "{identificador_do_contato}",
    "context": {
        "var1": "value1",
        "var2": "value2"
    }
}
```

Para obter o contexto é necessário marcar a opção "Incluir contexto do atendimento na resposta", disponível na tela de configuração da API.

#### **Header:**

```
Content-Type: application/json
Authorization: <token autogerado pelo ALTU> 
```

{% hint style="info" %}
Para que o POST no *callback* seja realizado, é **obrigatório** informar tanto a `URL` quanto o `Token`.
{% endhint %}

![](https://776911411-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MBjaNm5lB1Yqgih1JCA%2F-MRyU_ysnFPOzG4NZhUV%2F-MRy_BhrAV3ctzaH1Zfd%2Fimage.png?alt=media\&token=00532267-9c77-416f-8424-fad9aa92b534)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.altu.d1.cx/connect/canais/bot_api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
