# API externa

###

###

### ➜ Documentación

## Obteniendo el token de acceso al Api

<mark style="color:green;">`POST`</mark> `https://pdn.api.hibot.us/api_external/login`

Este endpoint se usa para generar un nuevo token de acceso para invocar el API externo.

#### Headers

| Name         | Type   | Description      |
| ------------ | ------ | ---------------- |
| Content-Type | string | application/json |

#### Request Body

| Name      | Type   | Description                    |
| --------- | ------ | ------------------------------ |
| appId     | string | Identificador de la aplicación |
| appSecret | string | Secreto de la aplicación       |

{% tabs %}
{% tab title="200 Token generado exitosamente" %}

```
{    "token": "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiI1YmE0MWJkNjVmNGFmYzRiZTAwMmEwY2EiLCJyb2xlcyI6IlJPTEVfQURNSU4iLCJpc3MiOiJoaWJvdC1leHRlcm5hbCIsImV4cCI6MTU4MzAwOTI2NH0.MRHFFVFXJ_j7ecUfpjk4TEZw5A2hO6fbrUQv8eVU3eo"}
```

{% endtab %}
{% endtabs %}

<mark style="color:green;">`POST`</mark> `https://pdn.api.hibot.us/api_external/sendMessage`

Con este endpoint puedes enviar un mensaje hacia un contacto

#### Headers

| Name         | Type   | Description                             |
| ------------ | ------ | --------------------------------------- |
| Content-Type | string | application/json                        |
| Bearer Token | string | Token generado con el appId y appSecret |

#### Request Body

| Name      | Type   | Description                                                  |
| --------- | ------ | ------------------------------------------------------------ |
| mediaType | string | <p>Tipo de Multimedia:<br>IMAGE, VIDEO, AUDIO o DOCUMENT</p> |
| media     | string | Url de la multimedia                                         |
| channelId | string | Id del canal                                                 |
| message   | string | Contenido del mensaje                                        |
| account   | string | Número de contacto ej: 5730200000                            |

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

```
```

{% endtab %}
{% endtabs %}


---

# 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.hibotchat.com/integracion/api-externa.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.
