# 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 %}
