> For the complete documentation index, see [llms.txt](https://api.direct.revicom.ltd/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://api.direct.revicom.ltd/messages/flashcall-sending.md).

# Sending FLASHCALL

## Sending FLASHCALL messages

<mark style="color:green;">`POST`</mark> `https://direct.revicom.ltd/api/v1/message`

The method allows for sending an array of single messages **(1 to 1,000)**

#### Headers

| Name                                            | Type   | Description        |
| ----------------------------------------------- | ------ | ------------------ |
| Authorization<mark style="color:red;">\*</mark> | string | `Basic {TOKEN_1}`  |
| Content-Type<mark style="color:red;">\*</mark>  | string | `application/json` |

#### Request Body

| Name                                          | Type   | Description                                                                                                                                                        |
| --------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| channelType<mark style="color:red;">\*</mark> | string | Sending channel (`FLASHCALL`)                                                                                                                                      |
| senderName<mark style="color:red;">\*</mark>  | string | Sender name. Any string is allowed. The call will come from a number, the last digits being the sent code.                                                         |
| destination<mark style="color:red;">\*</mark> | string | Subscriber number                                                                                                                                                  |
| content<mark style="color:red;">\*</mark>     | string | Numerical code, 4 symbols                                                                                                                                          |
| tags                                          | array  | Message tags (array of strings). Each tag must match the expression `^\w+$` (any case letters, numbers and underscore "\_" are allowed)                            |
| callbackUrl                                   | string | Address to send callback                                                                                                                                           |
| callbackEvents                                | array  | Events to send callback (an array of strings). If there is `callbackUrl` and no `callbackEvents` in the request, a callback will be sent on the event `delivered`. |

{% tabs %}
{% tab title="200" %}
If the request is successful, a response is returned that lists the message IDs and result codes. With errors = false, all submitted messages are guaranteed to have been successfully generated.

```
{
  "errors": false,
  "items": [
    {
      "messageUuid": "063474ec-a34f-4558-90c5-984395000004",
      "code": 201
    },
    {
      "messageUuid": "063564ec-a34f-4558-90c5-984395000005",
      "code": 201
    }
  ]
}
```

{% endtab %}

{% tab title="401" %}
Invalid token used.

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

```
{
    "error": {
        "code": 4012,
        "msg": "Bad credentials"
    }
}
```

{% endtab %}

{% tab title="4010" %}

```
{
    "error": {
        "code": 4010,
        "msg": "Not Authenticated"
    }
}
```

{% endtab %}
{% endtabs %}
{% endtab %}

{% tab title="403" %}
Token of wrong type used.

```
{
    "error": {
        "code": 4030,
        "msg": "Access Denied"
    }
}
```

{% endtab %}

{% tab title="422" %}
The request body contains invalid parameters; below are some response examples.

```
{
    "error": {
        "code": 4220,
        "msg": "Invalid content"
    }
}
-----------------------------------------------------------------------------
{
    "error": {
        "code": 4220,
        "msg": "Invalid msisdn"
    }
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
If you need to use codes consisting of more than four digits, please contact customer support.
{% endhint %}

{% hint style="warning" %}
Recommended minimum timeout: 70 seconds
{% endhint %}

Enumerations:

| Parameter      | Allowed values                                          |
| -------------- | ------------------------------------------------------- |
| callbackEvents | [Callback Events](/extra/references.md#callback-events) |

## Request example <a href="#example" id="example"></a>

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

```
POST https://direct.revicom.ltd/api/v1/message
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Content-Type: application/json
[
  {
    "channelType": "FLASHCALL",
    "senderName": "any sender",
    "destination": "14085553911",
    "content": "1234",
    "callbackUrl": "https://company.com/callback",
    "callbackEvents": [
      "sent",
      "delivered"
    ],
    "tags": [
      "tag1",
      "tag2"
    ]
  }
]
```

{% endtab %}

{% tab title="cURL" %}

```
curl -X POST 'https://direct.revicom.ltd/api/v1/message' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==' \
-d '[{"channelType":"FLASHCALL","senderName":"any sender","destination":"14085553911","content":"1234","callbackUrl":"https://company.com/callback","callbackEvents":["sent","delivered"],"tags":["tag1","tag2"]}]'
```

{% endtab %}
{% endtabs %}

## Sending FLASHCALL conversion

<mark style="color:green;">`POST`</mark> `https://direct.i-dgtl.ru/api/v1/flashcall-conversion`

The method is used to report the correctness of the user-entered code sent in a FLASHCALL message

#### Headers

| Name                                            | Type   | Description        |
| ----------------------------------------------- | ------ | ------------------ |
| Authorization<mark style="color:red;">\*</mark> | string | `Bearer {TOKEN_1}` |
| Content-Type<mark style="color:red;">\*</mark>  | string | `application/json` |

#### Request Body

| Name                                          | Type   | Description                                                                                                         |
| --------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------- |
| messageUuid<mark style="color:red;">\*</mark> | string | FLASHCALL message uuid                                                                                              |
| result<mark style="color:red;">\*</mark>      | string | <p>Code entry result<br>Code approved: <code>NUMBER\_VERIFIERD</code><br>Invalid code: <code>WRONG\_CODE</code></p> |
| code                                          | string | Code                                                                                                                |

{% tabs %}
{% tab title="200 This corresponds to the response to sending single messages" %}

```
{
  "errors": false,
  "items": [
    {
      "messageUuid": "063474ec-a34f-4558-90c5-984395000004",
      "code": 201
    },
    {
      "messageUuid": "063564ec-a34f-4558-90c5-984395000005",
      "code": 201
    }
  ]
}
```

{% endtab %}
{% endtabs %}

Enumerations:

| Parameter | Allowed values              |
| --------- | --------------------------- |
| result    | FLASHCALL conversion result |

{% hint style="info" %}
Sending the conversion assists in improvement of the quality of sending FLASHCALL-messages
{% endhint %}

## Request example <a href="#conversion-example" id="conversion-example"></a>

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

```
POST https://direct.i-dgtl.ru/api/v1/flashcall-conversion
Authorization: Bearer QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Content-Type: application/json
[
  {
    "messageUuid": "063464ec-a34f-4558-90c5-984395000004",
    "result": "NUMBER_VERIFIED",
    "code": "7777"
  }
]
```

{% endtab %}

{% tab title="cURL" %}

```
curl -X POST 'https://direct.i-dgtl.ru/api/v1/flashcall-conversion' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer QWxhZGRpbjpvcGVuIHNlc2FtZQ==' \
-d '[{"messageUuid":"063464ec-a34f-4558-90c5-984395000004","result":"NUMBER_VERIFIED","code":"7777"}]'
```

{% endtab %}
{% endtabs %}
