> For the complete documentation index, see [llms.txt](https://help.blinger.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.blinger.io/documentation/webhooks.md).

# Webhooks

{% hint style="warning" %}
For provision of access to the setting of webhooks, please, contact with our Support Team.
{% endhint %}

{% hint style="success" %}
Your server must return **HTTP 200 status** if the request is received successfully.
{% endhint %}

Webhooks can trigger the third-party solution on the following events occurred:

### Event: Conversation is unassigned

{% hint style="info" %}
Trigger when a conversation status changed to unassigned
{% endhint %}

{% code title="" %}

```javascript
{
    "webhook":"on_conversation_unassigned",
    "conversation":{
        "id":181,
        "application":"telegrambot",
        "status":"unassigned",
        "date_created":1513351579,
        "date_updated":1513353161,
        "from_user":{
            "user_id":374,
            "role":"default",
            "title":"Yuri Dzabaev",
            "avatar":"https://app.blinger.io/images/users/no-user.png",
            "page_title":"Blinger – Messengers for business", //only for livechat
            "page_url":"https://blinger.io", //only for livechat
            "status":"enabled",
            "service_user_id":"ta4ta4",
            "date_created":1513262192
        }
    }
}
```

{% endcode %}

### Event: Conversation is assigned to operator

{% hint style="info" %}
&#x20;Trigger when a conversation is assigned to operator.
{% endhint %}

{% code title="" %}

```javascript
{
    "webhook":"on_conversation_assigned",
    "conversation":{
        "id":180,
        "application":"telegrambot",
        "status":"inbox",
        "date_created":1513350728,
        "date_updated":1513351289,
        "operator":{
            "id":11,
            "name":"Supervisor",
            "email":"ta4@tut.by"
        },
        "from_user":{
            "user_id":374,
            "role":"default",
            "title":"Yuri Dzabaev",
            "avatar":"https://app.blinger.io/images/users/no-user.png",
            "page_title":"Blinger – Messengers for business", //only for livechat
            "page_url":"https://blinger.io", //only for livechat
            "status":"enabled",
            "service_user_id":"ta4ta4",
            "date_created":1513262192
        }
    }
}
```

{% endcode %}

### Event: Conversation is closed

{% hint style="info" %}
Trigger when a conversation is closed.
{% endhint %}

```javascript
{
    "webhook":"on_conversation_closed",
    "conversation":{
        "id":181,
        "application":"telegrambot",
        "status":"closed",
        "date_created":1513351579,
        "date_updated":1513353917,
        "operator":{
            "id":11,
            "name":"Supervisor",
            "email":"ta4@tut.by"
        },
        "from_user":{
            "user_id":374,
            "role":"default",
            "title":"Yuri Dzabaev",
            "avatar":"https://app.blinger.io/images/users/no-user.png",
            "page_title":"Blinger – Messengers for business", //only for livechat
            "page_url":"https://blinger.io", //only for livechat
            "status":"enabled",
            "service_user_id":"ta4ta4",
            "date_created":1513262192
        }
        "messages":[
            {
                "id":634,
                "from_blinger_user_id":547,
                "to_blinger_user_id":374,
                "from_user_id":547,
                "to_user_id":374,
                "type":"text",
                "application":"telegrambot",
                "message":"123",
                "blinger_message_id":4717,
                "date_created":1513353914,
                "status":"sent",
                "is_outgoing":true,
                "is_inner_message":false,
                "from_user_name":null,
                "to_user_name":"Yuri Dzabaev",
                "fromBlingerUser":{
                    "id":299,
                    "service_blinger_id":18,
                    "blinger_user_id":547,
                    "is_active":true,
                    "date_updated":1513346127,
                    "date_created":1513346127,
                    "tags":"[]",
                    "name":null,
                    "role":"customer",
                    "avatar":null,
                    "application":"telegrambot",
                    "service_user_id":null,
                    "status":"enabled"
                },
                "toBlingerUser":{
                    "id":294,
                    "service_blinger_id":18,
                    "blinger_user_id":374,
                    "is_active":true,
                    "date_updated":1513262192,
                    "date_created":1513262192,
                    "tags":null,
                    "name":"Yuri Dzabaev",
                    "role":"default",
                    "avatar":"https://app.blinger.io/images/users/no-user.png",
                    "application":"telegrambot",
                    "service_user_id":"ta4ta4",
                    "status":"enabled"
                }
            }
        ],
        "tags":[
            {
                "id":"id",
                "title":"test1",
                "message_id":"634"
            },
            {
                "id":"id",
                "title":"test1",
                "message_id":"634"
            },
            {
                "id":"id",
                "title":"test1",
                "message_id":"634"
            }
        ],
        'close_group' => [
            'title' => 'Duplicate',
        ],
    }
}
```

### Event: Incoming message

{% hint style="info" %}
Trigger when a new incoming message received.
{% endhint %}

```javascript
{
    "webhook":"on_message_incoming",
    "from_user_id":481,
    "to_user_id":542,
    "message_id":546,
    "message_blinger_id":4627,
    "conversation_id":173,
    "conversation_token":"G67iEBrRWGx6tz1Q84X5kREL2UhGC8XxzmbLszr60fLep_l6hjGghQ5Umdvac_8U",
    "operator":{
        "id":11, // null if conversation is not assigned to operator
        "name":"Supervisor", // null if conversation is not assigned to operator
        "email":"ta4@tut.by" // null if conversation is not assigned to operator
    },
    "from_user":{
        "user_id":481,
        "role":"default",
        "title":"Yuri Dzabaev",
        "avatar":"https://app.blinger.io/images/users/no-user.png",
        "page_title":"Blinger – Messengers for business", //only for livechat
        "page_url":"https://blinger.io", //only for livechat
        "status":"enabled",
        "application":"vk",
        "service_user_id":"101786025",
        "date_created":1513329664
    },
    "to_user":{
        "user_id":542,
        "role":"customer",
        "title":null,
        "avatar":null,
        "status":"enabled",
        "application":"vk",
        "service_user_id":null,
        "date_created":1513329654
    },
    "message":{
        "id":546,
        "from_user_id":481,
        "to_user_id":542,
        "type":"text",
        "application":"vk",
        "date_created":1513338128,
        "message":"test",
        "tags":["tag1", "tag2"]
    }
}
```

### Event: Outgoing message

{% hint style="info" %}
Trigger when a new outgoing message received
{% endhint %}

```javascript
{
    "webhook":"on_message_outgoing",
    "from_user_id":542,
    "to_user_id":481,
    "message_id":545,
    "message_blinger_id":4626,
    "conversation_id":173,
    "conversation_token":"G67iEBrRWGx6tz1Q84X5kREL2UhGC8XxzmbLszr60fLep_l6hjGghQ5Umdvac_8U",
    "operator":{
        "id":11,
        "name":"Supervisor",
        "email":"ta4@tut.by"
    },
    "from_user":{
        "user_id":542,
        "role":"customer",
        "title":null,
        "avatar":null,
        "page_title":"Blinger – Messengers for business", //only for livechat
        "page_url":"https://blinger.io", //only for livechat
        "status":"enabled",
        "application":"vk",
        "service_user_id":null,
        "date_created":1513329654
    },
    "to_user":{
        "user_id":481,
        "role":"default",
        "title":"Yuri Dzabaev",
        "avatar":"https://app.blinger.io/images/users/no-user.png",
        "page_title":"Blinger – Messengers for business", //only for livechat
        "page_url":"https://blinger.io", //only for livechat
        "status":"enabled",
        "application":"vk",
        "service_user_id":"101786025",
        "date_created":1513329664
    },
    "message":{
        "id":545,
        "from_user_id":542,
        "to_user_id":481,
        "type":"text",
        "application":"vk",
        "date_created":1513337982,
        "message":"123",
        "tags":["tag1", "tag2"]
    }
}
```

### Event: Incoming comment

{% hint style="info" %}
Trigger when a new incoming comment received
{% endhint %}

```javascript
{
    "webhook":"on_comment_incoming",
    "from_user_id":481,
    "to_user_id":542,
    "comment_id":546,
    "comment_blinger_id":4627,
    "conversation_id":173,
    "conversation_token":"G67iEBrRWGx6tz1Q84X5kREL2UhGC8XxzmbLszr60fLep_l6hjGghQ5Umdvac_8U",
    "operator":{
        "id":11, // null if conversation is not assigned to operator
        "name":"Supervisor", // null if conversation is not assigned to operator
        "email":"ta4@tut.by" // null if conversation is not assigned to operator
    },
    "from_user":{
        "user_id":481,
        "role":"default",
        "title":"Yuri Dzabaev",
        "avatar":"https://app.blinger.io/images/users/no-user.png",
        "status":"enabled",
        "application":"vk",
        "service_user_id":"101786025",
        "date_created":1513329664
    },
    "to_user":{
        "user_id":542,
        "role":"customer",
        "title":null,
        "avatar":null,
        "status":"enabled",
        "application":"vk",
        "service_user_id":null,
        "date_created":1513329654
    },
    "comment":{
        "id":546,
        "from_user_id":481,
        "to_user_id":542,
        "reply_comment_id":544,
        "type":"text",
        "post_id":"123123",
        "post_url":"https://vk.com/id1?w=wall1_2307813",
        "post_title":"Пост из вк",
        "application":"vk",
        "date_created":1513338128,
        "message":"test"
    }
}
```

### Event: Outgoing comment

{% hint style="info" %}
Trigger when a new outgoing comment received
{% endhint %}

```javascript
{
    "webhook":"on_comment_outgoing",
    "from_user_id":542,
    "to_user_id":481,
    "comment_id":545,
    "comment_blinger_id":4626,
    "conversation_id":173,
    "conversation_token":"G67iEBrRWGx6tz1Q84X5kREL2UhGC8XxzmbLszr60fLep_l6hjGghQ5Umdvac_8U",
    "operator":{
        "id":11,
        "name":"Supervisor",
        "email":"ta4@tut.by"
    },
    "from_user":{
        "user_id":542,
        "role":"customer",
        "title":null,
        "avatar":null,
        "status":"enabled",
        "application":"vk",
        "service_user_id":null,
        "date_created":1513329654
    },
    "to_user":{
        "user_id":481,
        "role":"default",
        "title":"Yuri Dzabaev",
        "avatar":"https://app.blinger.io/images/users/no-user.png",
        "status":"enabled",
        "application":"vk",
        "service_user_id":"101786025",
        "date_created":1513329664
    },
    "comment":{
        "id":545,
        "from_user_id":542,
        "to_user_id":481,
        "reply_comment_id":544,
        "type":"text",
        "post_id":"123123",
        "post_url":"https://vk.com/id1?w=wall1_2307813",
        "post_title":"Пост из вк",
        "application":"vk",
        "date_created":1513337982,
        "message":"123"
    }
}
```

### Event: New client

{% hint style="info" %}
Trigger when a new user is created
{% endhint %}

```javascript
{
    "webhook":"on_user_new",
    "user":{
        "id":294,
        "blinger_user_id":374,
        "name":"Yuri Dzabaev",
        "avatar":"https://app.blinger.io/images/users/no-user.png",
        "application":"telegrambot",
        "service_user_id":"ta4ta4",
        "date_created":1513262192
    }
}
```

<br>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://help.blinger.io/documentation/webhooks.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
