# Conversation

## Start conversation

<mark style="color:green;">`POST`</mark> `https://app.blinger.io/api/conversations/start`

This endpoint allows you to start the conversation.

#### Headers

| Name           | Type   | Description          |
| -------------- | ------ | -------------------- |
| Authentication | string | Authentication token |

#### Request Body

| Name             | Type    | Description     |
| ---------------- | ------- | --------------- |
| conversation\_id | integer |                 |
| operator\_id     | integer | Default - Admin |
| disable\_webhook | integer | Default - 0     |

{% tabs %}
{% tab title="200 Conversation successfully started." %}

```javascript
{
    "status": 200,
    "data": {
        "id": 2,
        "user_id": 1,
        "operator_user_id": 1,
        "from_blinger_user_id": 5,
        "to_blinger_user_id": 4,
        "from_user_name": "LiveChat client #5",
        "to_user_name": "user@gmail.com",
        "application": "livechat",
        "last_message": "124124",
        "unread_count": 0,
        "status": "inbox",
        "date_created": 1559737532,
        "date_updated": 1560107366,
        "from_user_avatar": null,
        "is_outgoing": false,
        "token": "A0N_JeEemP_2TItFDcw-RrvuIrJ4ZWcdQixrkYB1PBJP7c5ZKLN0Mm200XCr8ABU",
        "is_new_conversation": false,
        "waiting_operator_response": false,
        "group_id": 1,
        "is_inner_message": null,
        "is_operator_last_message": true,
        "is_group_closed": false,
        "close_group": null,
        "type": "message",
        "comment_post_id": null,
        "comment_post_url": null,
        "comment_post_title": null,
        "comment_post_img": null,
        "unassigned_date": 1559807929,
        "last_message_date": 1559826168,
        "from_user_custom_name": null,
        "toBlingerUser": {
            "id": 4,
            "service_blinger_id": 1,
            "blinger_user_id": 4,
            "is_active": true,
            "date_updated": 1559737517,
            "date_created": 1559737517,
            "tags": null,
            "name": null,
            "role": "customer",
            "avatar": null,
            "application": "livechat",
            "service_user_id": null,
            "status": "enabled",
            "group_id": null,
            "is_comments": null,
            "page_url": null,
            "page_title": null,
            "extra_fields": null,
            "extra_field_secret_key": "g9k0jUSfIBdr12zgMJWLVKoi-WdhSyaf",
            "custom_name": null
        }
    }
}
```

{% endtab %}

{% tab title="400 Could not to start the conversation." %}

```javascript
{
    "error": "The c    onversation was assigned to another operator",
    "status": 400
}
```

{% endtab %}
{% endtabs %}

## Close conversation

<mark style="color:green;">`POST`</mark> `https://app.blinger.io/api/conversations/close`

This endpoint allows you to close the conversation.

#### Headers

| Name           | Type   | Description          |
| -------------- | ------ | -------------------- |
| Authentication | string | Authentication token |

#### Request Body

| Name             | Type    | Description     |
| ---------------- | ------- | --------------- |
| conversation\_id | integer |                 |
| operator\_id     | integer | Default - Admin |
| disable\_webhook | integer | Default - 0     |

{% tabs %}
{% tab title="200 Conversation successfully closed." %}

```javascript
{
    "status": 200,
    "data": {
        "id": 2,
        "user_id": 1,
        "operator_user_id": 1,
        "from_blinger_user_id": 5,
        "to_blinger_user_id": 4,
        "from_user_name": "LiveChat client #5",
        "to_user_name": "artemylapko@gmail.com",
        "application": "livechat",
        "last_message": "124124",
        "unread_count": 0,
        "status": "closed",
        "date_created": 1559737532,
        "date_updated": 1560187173,
        "from_user_avatar": null,
        "is_outgoing": false,
        "token": "A0N_JeEemP_2TItFDcw-RrvuIrJ4ZWcdQixrkYB1PBJP7c5ZKLN0Mm200XCr8ABU",
        "is_new_conversation": false,
        "waiting_operator_response": false,
        "group_id": 1,
        "is_inner_message": null,
        "is_operator_last_message": true,
        "is_group_closed": false,
        "close_group": null,
        "type": "message",
        "comment_post_id": null,
        "comment_post_url": null,
        "comment_post_title": null,
        "comment_post_img": null,
        "unassigned_date": 1559807929,
        "last_message_date": 1560185816,
        "from_user_custom_name": null,
        "toBlingerUser": {
            "id": 4,
            "service_blinger_id": 1,
            "blinger_user_id": 4,
            "is_active": true,
            "date_updated": 1559737517,
            "date_created": 1559737517,
            "tags": null,
            "name": null,
            "role": "customer",
            "avatar": null,
            "application": "livechat",
            "service_user_id": null,
            "status": "enabled",
            "group_id": null,
            "is_comments": null,
            "page_url": null,
            "page_title": null,
            "extra_fields": null,
            "extra_field_secret_key": "g9k0jUSfIBdr12zgMJWLVKoi-WdhSyaf",
            "custom_name": null
        }
    }
}a
```

{% endtab %}

{% tab title="400 Could not close the conversation." %}

```javascript
{
    "error": "The conversation is closed.",
    "status": 400
}
```

{% endtab %}
{% endtabs %}

## Unassign conversation&#x20;

<mark style="color:green;">`POST`</mark> `https://app.blinger.io/api/conversations/unassign`

#### Path Parameters

| Name           | Type   | Description          |
| -------------- | ------ | -------------------- |
| Authentication | string | Authentication token |

#### Request Body

| Name             | Type    | Description     |
| ---------------- | ------- | --------------- |
| conversation\_id | integer |                 |
| operator\_id     | integer | Default - Admin |
| disable\_webhook | integer | Default - 0     |

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

```
{
    "status": 200,
    "data": {
        "id": 2,
        "user_id": 1,
        "operator_user_id": 1,
        "from_blinger_user_id": 5,
        "to_blinger_user_id": 4,
        "from_user_name": "LiveChat client #5",
        "to_user_name": "artemylapko@gmail.com",
        "application": "livechat",
        "last_message": "124124",
        "unread_count": 0,
        "status": "closed",
        "date_created": 1559737532,
        "date_updated": 1560187173,
        "from_user_avatar": null,
        "is_outgoing": false,
        "token": "A0N_JeEemP_2TItFDcw-RrvuIrJ4ZWcdQixrkYB1PBJP7c5ZKLN0Mm200XCr8ABU",
        "is_new_conversation": false,
        "waiting_operator_response": false,
        "group_id": 1,
        "is_inner_message": null,
        "is_operator_last_message": true,
        "is_group_closed": false,
        "close_group": null,
        "type": "message",
        "comment_post_id": null,
        "comment_post_url": null,
        "comment_post_title": null,
        "comment_post_img": null,
        "unassigned_date": 1559807929,
        "last_message_date": 1560185816,
        "from_user_custom_name": null,
        "toBlingerUser": {
            "id": 4,
            "service_blinger_id": 1,
            "blinger_user_id": 4,
            "is_active": true,
            "date_updated": 1559737517,
            "date_created": 1559737517,
            "tags": null,
            "name": null,
            "role": "customer",
            "avatar": null,
            "application": "livechat",
            "service_user_id": null,
            "status": "enabled",
            "group_id": null,
            "is_comments": null,
            "page_url": null,
            "page_title": null,
            "extra_fields": null,
            "extra_field_secret_key": "g9k0jUSfIBdr12zgMJWLVKoi-WdhSyaf",
            "custom_name": null
        }
    }
}
```

{% endtab %}

{% tab title="400 " %}

```
{
    "error": "The conversation is already unassigned.",
    "status": 400
}
```

{% endtab %}
{% endtabs %}

## Assign operator

<mark style="color:green;">`POST`</mark> `https://app.blinger.io/api/conversations/assign-operator`

This endpoint allows you to assign the operator to the conversations

#### Headers

| Name           | Type   | Description          |
| -------------- | ------ | -------------------- |
| Authentication | string | Authentication token |

#### Request Body

| Name             | Type    | Description |
| ---------------- | ------- | ----------- |
| conversation\_id | integer |             |
| operator\_id     | integer |             |
| disable\_webhook | integer | Default - 0 |

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

```javascript
{
    "status": 200,
    "data": {
        "id": 2,
        "user_id": 1,
        "operator_user_id": 3,
        "from_blinger_user_id": 5,
        "to_blinger_user_id": 4,
        "from_user_name": "LiveChat client #5",
        "to_user_name": "artemylapko@gmail.com",
        "application": "livechat",
        "last_message": "124124",
        "unread_count": 1,
        "status": "inbox",
        "date_created": 1559737532,
        "date_updated": 1560188161,
        "from_user_avatar": null,
        "is_outgoing": false,
        "token": "A0N_JeEemP_2TItFDcw-RrvuIrJ4ZWcdQixrkYB1PBJP7c5ZKLN0Mm200XCr8ABU",
        "is_new_conversation": false,
        "waiting_operator_response": false,
        "group_id": 1,
        "is_inner_message": null,
        "is_operator_last_message": true,
        "is_group_closed": false,
        "close_group": null,
        "type": "message",
        "comment_post_id": null,
        "comment_post_url": null,
        "comment_post_title": null,
        "comment_post_img": null,
        "unassigned_date": 1559807929,
        "last_message_date": 1560185816,
        "from_user_custom_name": null,
        "toBlingerUser": {
            "id": 4,
            "service_blinger_id": 1,
            "blinger_user_id": 4,
            "is_active": true,
            "date_updated": 1559737517,
            "date_created": 1559737517,
            "tags": null,
            "name": null,
            "role": "customer",
            "avatar": null,
            "application": "livechat",
            "service_user_id": null,
            "status": "enabled",
            "group_id": null,
            "is_comments": null,
            "page_url": null,
            "page_title": null,
            "extra_fields": null,
            "extra_field_secret_key": "g9k0jUSfIBdr12zgMJWLVKoi-WdhSyaf",
            "custom_name": null
        }
    }
}
```

{% endtab %}

{% tab title="400 " %}

```javascript
{
    "error": "The conversation has already been assigned to this operator.",
    "status": 400
}
```

{% endtab %}
{% endtabs %}

## Assign group

<mark style="color:green;">`POST`</mark> `https://app.blinger.io/api/conversations/assign-group`

This endpoint allows you to assign the group to the conversation

#### Headers

| Name           | Type   | Description          |
| -------------- | ------ | -------------------- |
| Authentication | string | Authentication token |

#### Request Body

| Name             | Type    | Description |
| ---------------- | ------- | ----------- |
| conversation\_id | integer |             |
| group\_id        | integer |             |

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

```javascript
{
    "status": 200,
    "data": {
        "id": 2,
        "user_id": 1,
        "operator_user_id": 3,
        "from_blinger_user_id": 5,
        "to_blinger_user_id": 4,
        "from_user_name": "LiveChat client #5",
        "to_user_name": "artemylapko@gmail.com",
        "application": "livechat",
        "last_message": "124124",
        "unread_count": 1,
        "status": "inbox",
        "date_created": 1559737532,
        "date_updated": 1560188258,
        "from_user_avatar": null,
        "is_outgoing": false,
        "token": "A0N_JeEemP_2TItFDcw-RrvuIrJ4ZWcdQixrkYB1PBJP7c5ZKLN0Mm200XCr8ABU",
        "is_new_conversation": false,
        "waiting_operator_response": false,
        "group_id": 1,
        "is_inner_message": null,
        "is_operator_last_message": true,
        "is_group_closed": false,
        "close_group": null,
        "type": "message",
        "comment_post_id": null,
        "comment_post_url": null,
        "comment_post_title": null,
        "comment_post_img": null,
        "unassigned_date": 1559807929,
        "last_message_date": 1560185816,
        "from_user_custom_name": null,
        "toBlingerUser": {
            "id": 4,
            "service_blinger_id": 1,
            "blinger_user_id": 4,
            "is_active": true,
            "date_updated": 1559737517,
            "date_created": 1559737517,
            "tags": null,
            "name": null,
            "role": "customer",
            "avatar": null,
            "application": "livechat",
            "service_user_id": null,
            "status": "enabled",
            "group_id": null,
            "is_comments": null,
            "page_url": null,
            "page_title": null,
            "extra_fields": null,
            "extra_field_secret_key": "g9k0jUSfIBdr12zgMJWLVKoi-WdhSyaf",
            "custom_name": null
        }
    }
}
```

{% endtab %}

{% tab title="400 " %}

```javascript
{
    "error": "The operator group has already been selected.",
    "status": 400
}
```

{% endtab %}
{% endtabs %}

## Send message

<mark style="color:green;">`POST`</mark> `https://app.blinger.io/api/conversations/send-message`

#### Headers

| Name           | Type   | Description          |
| -------------- | ------ | -------------------- |
| Authentication | string | Authentication token |

#### Request Body

| Name             | Type    | Description     |
| ---------------- | ------- | --------------- |
| conversation\_id | integer |                 |
| text             | string  |                 |
| operator\_id     | integer | Default - Admin |
| disable\_webhook | integer | Default - 0     |

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

```javascript
{
    "status": 200,
    "data": {
        "id": 178,
        "from_blinger_user_id": 4,
        "to_blinger_user_id": 5,
        "blinger_message_id": 178,
        "application": "livechat",
        "type": "text",
        "message": "124124",
        "date_updated": 1560188469,
        "date_created": 1560188469,
        "is_outgoing": true,
        "status": "sent",
        "is_inner_message": false,
        "date_read": null,
        "date_real": 15601884680000,
        "error": null,
        "is_history": false,
        "echo": false,
        "echo_outgoing": false
    }
}
```

{% endtab %}

{% tab title="400 " %}

```javascript
{
    "error": "text is empty",
    "status": 400
}
```

{% endtab %}
{% endtabs %}

## Send file message

<mark style="color:green;">`POST`</mark> `https://app.blinger.io/api/conversations/send-file-message`

#### Path Parameters

| Name           | Type   | Description          |
| -------------- | ------ | -------------------- |
| Authentication | string | Authentication token |

#### Request Body

| Name             | Type    | Description     |
| ---------------- | ------- | --------------- |
| conversation\_id | integer |                 |
| file\_url        | string  |                 |
| operator\_id     | integer | Default - Admin |
| disable\_webhook | integer | Default - 0     |

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

```
{
    "status": 200,
    "data": {
        "id": 178,
        "from_blinger_user_id": 4,
        "to_blinger_user_id": 5,
        "blinger_message_id": 178,
        "application": "livechat",
        "type": "image",
        "message": "https://static-api.blinger.io/files/new/67/cf/67cf7f4783de908d9723696d295c5252_5e60f6d59964e.png",
        "date_updated": 1560188469,
        "date_created": 1560188469,
        "is_outgoing": true,
        "status": "sent",
        "is_inner_message": false,
        "date_read": null,
        "date_real": 15601884680000,
        "error": null,
        "is_history": false,
        "echo": false,
        "echo_outgoing": false
    }
}
```

{% endtab %}

{% tab title="400 " %}

```
{
    "error": "file_url is empty",
    "status": 400
}
```

{% endtab %}
{% endtabs %}

## Send note

<mark style="color:green;">`POST`</mark> `https://app.blinger.io/api/conversations/send-note`

#### Path Parameters

| Name           | Type   | Description          |
| -------------- | ------ | -------------------- |
| Authentication | string | Authentication token |

#### Request Body

| Name             | Type    | Description     |
| ---------------- | ------- | --------------- |
| operator\_id     | integer | Default - Admin |
| text             | string  |                 |
| conversation\_id | integer |                 |

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

```
{
    "status": 200,
    "data": {
        "id": 178,
        "from_blinger_user_id": 4,
        "to_blinger_user_id": 5,
        "blinger_message_id": null,
        "application": "livechat",
        "type": "text",
        "message": "My private note",
        "date_updated": 1560188469,
        "date_created": 1560188469,
        "is_outgoing": true,
        "status": "sent",
        "is_inner_message": true,
        "date_read": null,
        "date_real": 15601884680000,
        "error": null,
        "is_history": false,
        "echo": false,
        "echo_outgoing": false
    }
}
```

{% endtab %}
{% endtabs %}

## Get unassigned conversations

<mark style="color:blue;">`GET`</mark> `https://app.blinger.io/api/conversations/unassigned`

This endpoint allows you to get unassigned conversations. Conversations are sorted by date updated in descending order (limit 1000).

#### Path Parameters

| Name      | Type    | Description |
| --------- | ------- | ----------- |
| group\_id | integer |             |

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

```
{
    "status": 200,
    "data": [
        {
            "id": 300,
            "group_id": 21,
            "status": "unassigned",
            "application": "livechat",
            "from_blinger_user_id": 2,
            "from_user_name": "LiveChat client #2",
            "is_new_conversation": true,
            "unassigned_date": 1563894618,
            "custom_name": "John Doe"
        }
    ]
}
```

{% endtab %}
{% endtabs %}

## Get unread conversations

<mark style="color:blue;">`GET`</mark> `https://app.blinger.io/api/conversations/unread`

This endpoint allows you to get unread conversations with status "inbox" for a specific operator. Conversations are sorted by date updated in descending order (limit 1000).

#### Path Parameters

| Name         | Type    | Description |
| ------------ | ------- | ----------- |
| operator\_id | integer |             |
| group\_id    | integer |             |

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

```
{
    "status": 200,
    "data": [
        {
            "id": 300,
            "group_id": 21,
            "operator_user_id": 18,
            "status": "inbox",
            "application": "livechat",
            "from_blinger_user_id": 2,
            "from_user_name": "LiveChat client #2",
            "is_new_conversation": false,
            "unread_count": 2,
            "last_message_date": 1563895196,
            "custom_name": "John Doe",
            "operator_email": "operator@gmail.com"
        }
    ]
}
```

{% endtab %}
{% endtabs %}

## Get not answered conversations

<mark style="color:blue;">`GET`</mark> `https://app.blinger.io/api/conversations/not-answered`

This endpoint allows you to get not answered conversations with status "inbox" for a specific operator. Conversations are sorted by date updated in descending order (limit 1000).

#### Path Parameters

| Name         | Type    | Description |
| ------------ | ------- | ----------- |
| operator\_id | integer |             |
| group\_id    | integer |             |

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

```
{
    "status": 200,
    "data": [
        {
            "id": 300,
            "group_id": 21,
            "operator_user_id": 18,
            "status": "inbox",
            "application": "livechat",
            "from_blinger_user_id": 2,
            "from_user_name": "LiveChat client #2",
            "is_new_conversation": false,
            "unread_count": 0,
            "last_message_date": 1563895196,
            "custom_name": "John Doe",
            "operator_email": "operator@gmail.com"
        }
    ]
}
```

{% endtab %}
{% endtabs %}

## Get conversation by ID

<mark style="color:blue;">`GET`</mark> `https://app.blinger.io/api/conversations/get`

This endpoint allows you to get conversation info by **ID**

#### Query Parameters

| Name                                               | Type    | Description |
| -------------------------------------------------- | ------- | ----------- |
| conversation\_id<mark style="color:red;">\*</mark> | integer |             |

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

```javascript
{
    "status": 200,
    "data": {
        "conversation_id": 5867,
        "operator_id": 457,
        "from_blinger_user_id": 12654,
        "to_blinger_user_id": 64456,
        "from_user": {
            "id": 10,
            "service_blinger_id": 2,
            "blinger_user_id": 12654,
            "is_active": true,
            "date_updated": 1634559429,
            "date_created": 1634559429,
            "tags": null,
            "name": "Alex",
            "role": "default",
            "avatar": null,
            "application": "telegrambot",
            "service_user_id": "253560468",
            "status": "enabled",
            "group_id": null,
            "is_comments": null,
            "page_url": null,
            "page_title": null,
            "extra_fields": null,
            "extra_field_secret_key": "7YCH_DHyQIHsMB1rfuQM85tgbFX3Qrfq",
            "custom_name": null,
            "dialog_id": null,
            "comments_group_id": null,
            "phone": "+37529576375",
            "service_user_nickname": "alex"
        },
        "to_user": {
            "id": 44,
            "service_blinger_id": 2,
            "blinger_user_id": 64456,
            "is_active": true,
            "date_updated": 1635854447,
            "date_created": 1635854447,
            "tags": null,
            "name": null,
            "role": "customer",
            "avatar": null,
            "application": "telegrambot",
            "service_user_id": null,
            "status": "enabled",
            "group_id": null,
            "is_comments": null,
            "page_url": null,
            "page_title": null,
            "extra_fields": null,
            "extra_field_secret_key": "TSrwT2DvVJZFX9nJu3AQEcCFVMxQa3P4",
            "custom_name": null,
            "dialog_id": null,
            "comments_group_id": null,
            "phone": null,
            "service_user_nickname": null
        },
        "application": "telegrambot",
        "status": "inbox",
        "date_created": 1635856462,
        "date_updated": 1643971557,
        "messages": [
            {
                "id": 7532,
                "message": "/start",
                "type": "text",
                "date_created": 1635856462
            },
            {
                "id": 7543,
                "message": "Hello, can I help you?",
                "type": "text",
                "date_created": 1635856464,
                "operator_id": 457
            },
            {
                "id": 8634,
                "message": "Hello!",
                "type": "text",
                "date_created": 1635863152
            }
        ]
    }
}
```

{% 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://help.blinger.io/documentation/api/conversation-1.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.
