Skip to content

Commit 2847cf4

Browse files
authored
feat(docs): messaging: add event_preview (#1578)
1 parent 7fa80db commit 2847cf4

File tree

5 files changed

+148
-3
lines changed

5 files changed

+148
-3
lines changed

src/pages/messaging/agent-chat-api/changelog/index.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ The developer preview version provides a preview of the upcoming changes to the
3535
- A new structure for the [**Deleted Event**](/messaging/agent-chat-api/v3.6/data-structures/#deleted-event) was added.
3636
- There are new pushes:
3737
- [**event_deleted**](/messaging/agent-chat-api/v3.6/rtm-pushes/#event_deleted)
38+
- There's a new method, **Send Event Preview** ([Web](/messaging/agent-chat-api/v3.6/#send-event-preview) & [RTM](/messaging/agent-chat-api/v3.6/rtm-reference/#send-event-preview)).
3839

3940
### Customers
4041

src/pages/messaging/agent-chat-api/v3.6/index.mdx

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ curl -X POST \
107107
| **Chats** | [`list_chats`](#list-chats) [`list_threads`](#list-threads) [`get_chat`](#get-chat) [`list_archives`](#list-archives) [`start_chat`](#start-chat) [`resume_chat`](#resume-chat) [`deactivate_chat`](#deactivate-chat) [`follow_chat`](#follow-chat) [`unfollow_chat`](#unfollow-chat) |
108108
| **Chat access** | [`transfer_chat`](#transfer-chat) |
109109
| **Chat users** | [`add_user_to_chat`](#add-user-to-chat) [`remove_user_from_chat`](#remove-user-from-chat) |
110-
| **Events** | [`send_event`](#send-event) [`upload_file`](#upload-file) [`send_rich_message_postback`](#send-rich-message-postback) |
110+
| **Events** | [`send_event_preview`](#send-event-preview) [`send_event`](#send-event) [`upload_file`](#upload-file) [`send_rich_message_postback`](#send-rich-message-postback) |
111111
| **Properties** | [`update_chat_properties`](#update-chat-properties) [`delete_chat_properties`](#delete-chat-properties) [`update_thread_properties`](#update-thread-properties) [`delete_thread_properties`](#delete-thread-properties) [`update_event_properties`](#update-event-properties) [`delete_event_properties`](#delete-event-properties) |
112112
| **Thread tags** | [`tag_thread`](#tag-thread) [`untag_thread`](#untag-thread) |
113113
| **Customers** | [`get_customer`](#get-customer) [`update_customer`](#update-customer) [`ban_customer`](#ban-customer) [`follow_customer`](#follow-customer) [`unfollow_customer`](#unfollow-customer) |
@@ -1185,6 +1185,61 @@ https://api.livechatinc.com/v3.6/agent/action/remove_user_from_chat \
11851185
<Section>
11861186
<Text>
11871187

1188+
### Send Event Preview
1189+
1190+
Sends an [event](/messaging/agent-chat-api/v3.6/data-structures/#events) that isn't saved in the chat. Use this method when you're preparing a longer response and want to send a partial update before sending the final message with [Send Event](/messaging/agent-chat-api/v3.6/#send-event). Only [Message](/messaging/agent-chat-api/v3.6/data-structures/#message) is supported. Visibility must be set to `all` or skipped. The user must be [added to the chat](/messaging/agent-chat-api/rtm-pushes/#user_added_to_chat) before they can send an event.
1191+
1192+
#### Specifics
1193+
1194+
| | |
1195+
| ---------------------- | ---------------------------------------------------------------------------------------- |
1196+
| **Method URL** | `https://api.livechatinc.com/v3.6/agent/action/send_event_preview` |
1197+
| **Required scopes** | `chats--all:rw` **\*** or `chats--access:rw` **\*\*** |
1198+
| **RTM API equivalent** | [`send_event_preview`](/messaging/agent-chat-api/v3.6/rtm-reference/#send-event_preview) |
1199+
| **Webhook** | - |
1200+
1201+
**\*)** `chats--all:rw` - to send an event to a chat taking place in any group.
1202+
1203+
**\*\*)** `chats--access:rw` - to send an event to a chat taking place in groups that the requester (related to the token) is a member of. (The agent groups and the chat groups must overlap - at least one group must be in common.)
1204+
1205+
#### Request
1206+
1207+
| Parameter | Required | Data type | Notes |
1208+
| --------- | -------- | --------- | ------------------------------------------------------------------------------------------------ |
1209+
| `chat_id` | Yes | `string` | Id of the chat you want to send a message to. |
1210+
| `event` | Yes | `object` | [Event](/messaging/agent-chat-api/data-structures/#events) object. Supports only `message` type. |
1211+
1212+
#### Response
1213+
1214+
No response payload (`200 OK`).
1215+
1216+
</Text>
1217+
<Code>
1218+
<CodeSample path={'REQUEST'}>
1219+
1220+
```shell
1221+
curl -X POST \
1222+
https://api.livechatinc.com/v3.6/agent/action/send_event_preview \
1223+
-H 'Authorization: Bearer <your_access_token>' \
1224+
-H 'Content-Type: application/json' \
1225+
-d '{
1226+
"chat_id": "PW94SJTGW6",
1227+
"event": {
1228+
"type": "message",
1229+
"text": "Preview of a longer response...",
1230+
"visibility": "all",
1231+
"custom_id": "31-0C-1C-07-DB-16"
1232+
}
1233+
}'
1234+
```
1235+
1236+
</CodeSample>
1237+
</Code>
1238+
</Section>
1239+
1240+
<Section>
1241+
<Text>
1242+
11881243
### Send Event
11891244

11901245
Sends an [Event](/messaging/agent-chat-api/v3.6/data-structures/#events) object. Use this method to send a message by specifying the [Message](/messaging/agent-chat-api/v3.6/data-structures/#message) event type in the request.

src/pages/messaging/agent-chat-api/v3.6/rtm-reference/index.mdx

Lines changed: 67 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ When connecting to the Agent Chat RTM API, clients have to send over the require
113113
| **Chats** | [`list_chats`](#list-chats) [`list_threads`](#list-threads) [`get_chat`](#get-chat) [`list_archives`](#list-archives) [`start_chat`](#start-chat) [`resume_chat`](#resume-chat) [`deactivate_chat`](#deactivate-chat) [`follow_chat`](#follow-chat) [`unfollow_chat`](#unfollow-chat) |
114114
| **Chat access** | [`transfer_chat`](#transfer-chat) |
115115
| **Chat users** | [`add_user_to_chat`](#add-user-to-chat) [`remove_user_from_chat`](#remove-user-from-chat) |
116-
| **Events** | [`send_event`](#send-event) [`send_rich_message_postback`](#send-rich-message-postback) |
116+
| **Events** | [`send_event_preview`](#send-event-preview) [`send_event`](#send-event) [`send_rich_message_postback`](#send-rich-message-postback) |
117117
| **Properties** | [`update_chat_properties`](#update-chat-properties) [`delete_chat_properties`](#delete-chat-properties) [`update_thread_properties`](#update-thread-properties) [`delete_thread_properties`](#delete-thread-properties) [`update_event_properties`](#update-event-properties) [`delete_event_properties`](#delete-event-properties) |
118118
| **Thread tags** | [`tag_thread`](#tag-thread) [`untag_thread`](#untag-thread) |
119119
| **Customers** | [`get_customer`](#get-customer) [`update_customer`](#update-customer) [`ban_customer`](#ban-customer) [`follow_customer`](#follow-customer) [`unfollow_customer`](#unfollow-customer) [`subscribe_customers`](#subscribe_customers) [`unsubscribe_customers`](#unsubscribe_customers) |
@@ -1319,6 +1319,72 @@ Removes a user from chat. The following restrictions apply:
13191319

13201320
## Events
13211321

1322+
### Send Event Preview
1323+
1324+
Sends an [event](/messaging/agent-chat-api/v3.6/data-structures/#events) that isn't saved in the chat. Use this method when you're preparing a longer response and want to send a partial update before sending the final message with [Send Event](/messaging/agent-chat-api/v3.6/rtm-reference#send-event). Only [Message](/messaging/agent-chat-api/v3.6/data-structures/#message) is supported. Visibility must be set to `all` or skipped. The user must be [added to the chat](/messaging/agent-chat-api/rtm-pushes/#user_added_to_chat) before they can send an event.
1325+
1326+
#### Specifics
1327+
1328+
| |
1329+
| ---------------------- | -------------------------------------------------------------------------- |
1330+
| **Action** | `send_event_preview` |
1331+
| **Required scopes** | `chats--all:rw` **\*** or `chats--access:rw` **\*\*** |
1332+
| **Web API equivalent** | [`send_event_preview`](/messaging/agent-chat-api/v3.6/#send-event-preview) |
1333+
| **Push message** | - |
1334+
1335+
**\*)** `chats--all:rw` - to send an event to a chat taking place in any group.
1336+
1337+
**\*\*)** `chats--access:rw` - to send an event to a chat taking place in groups that the requester (related to the token) is a member of. (The agent groups and the chat groups must overlap - at least one group must be in common.)
1338+
1339+
#### Request
1340+
1341+
| Parameters | Required | Data type | Notes |
1342+
| ---------- | -------- | --------- | ------------------------------------------------------------------------------------------------ |
1343+
| `chat_id` | Yes | `string` | Id of the chat you want to send the message to. |
1344+
| `event` | Yes | `object` | [Event](/messaging/agent-chat-api/data-structures/#events) object. Supports only `message` type. |
1345+
1346+
</Text>
1347+
<Code>
1348+
<CodeSample path={'REQUEST'}>
1349+
1350+
```json
1351+
{
1352+
"action": "send_event",
1353+
"payload": {
1354+
"chat_id": "PW94SJTGW6",
1355+
"event": {
1356+
"type": "message",
1357+
"text": "Preview of a longer response...",
1358+
"visibility": "all",
1359+
"custom_id": "31-0C-1C-07-DB-16"
1360+
}
1361+
}
1362+
}
1363+
```
1364+
1365+
</CodeSample>
1366+
1367+
<CodeResponse>
1368+
1369+
```json
1370+
{
1371+
"request_id": "<request_id>", // optional
1372+
"action": "send_event_preview",
1373+
"type": "response",
1374+
"success": true,
1375+
"payload": {
1376+
//no response payload
1377+
}
1378+
}
1379+
```
1380+
1381+
</CodeResponse>
1382+
</Code>
1383+
</Section>
1384+
1385+
<Section>
1386+
<Text>
1387+
13221388
### Send Event
13231389

13241390
Sends an [Event](/messaging/agent-chat-api/v3.6/data-structures/#events) object. Use this method to send a message by specifying the [Message](/messaging/agent-chat-api/v3.6/data-structures/#message) event type in the request.

src/pages/messaging/customer-chat-api/changelog/index.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ The developer preview version provides a preview of the upcoming changes to the
3131
- There's a new method, **Delete Event** ([Web](/messaging/customer-chat-api/v3.6/#delete-event) and [RTM](/messaging/customer-chat-api/v3.6/rtm-reference#delete-event)).
3232
- There are new pushes:
3333
- [**event_deleted**](/messaging/customer-chat-api/v3.6/rtm-pushes/#event_deleted)
34+
- [**incoming_event_preview**](/messaging/customer-chat-api/v3.6/rtm-pushes/#incoming_event_preview)
3435

3536
### Customers
3637

src/pages/messaging/customer-chat-api/v3.6/rtm-pushes/index.mdx

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Here's what you need to know about **pushes**:
3232
| **Chats** | [`incoming_chat`](#incoming_chat) [`chat_deactivated`](#chat_deactivated) |
3333
| **Chat access** | [`chat_transferred`](#chat_transferred) |
3434
| **Chat users** | [`user_added_to_chat`](#user_added_to_chat) [`user_removed_from_chat`](#user_removed_from_chat) |
35-
| **Events** | [`incoming_event`](#incoming_event) [`event_deleted`](#event_deleted) [`event_updated`](#event_updated) [`incoming_rich_message_postback`](#incoming_rich_message_postback) |
35+
| **Events** | [`incoming_event_preview`](#incoming_event_preview) [`incoming_event`](#incoming_event) [`event_deleted`](#event_deleted) [`event_updated`](#event_updated) [`incoming_rich_message_postback`](#incoming_rich_message_postback) |
3636
| **Properties** | [`chat_properties_updated`](#chat_properties_updated) [`chat_properties_deleted`](#chat_properties_deleted) [`thread_properties_updated`](#thread_properties_updated) [`thread_properties_deleted`](#thread_properties_deleted) [`event_properties_updated`](#event_properties_updated) [`event_properties_deleted`](#event_properties_deleted) |
3737
| **Customers** | [`customer_updated`](#customer_updated) [`customer_side_storage_updated`](#customer_side_storage_updated) |
3838
| **Status** | [`customer_disconnected`](#customer_disconnected) [`groups_status_updated`](#groups_status_updated) |
@@ -214,6 +214,28 @@ Informs that a user (Customer or Agent) was removed from a chat.
214214

215215
## Events
216216

217+
### `incoming_event_preview`
218+
219+
Informs about an incoming [event](/messaging/customer-chat-api/v3.6/data-structures/#events) preview sent to a chat.
220+
221+
<CodeResponse title={'Sample push payload'}>
222+
223+
```json
224+
{
225+
"chat_id": "PJ0MRSHTDG",
226+
"thread_id": "K600PKZON8",
227+
"event": {
228+
"created_at": "2019-12-05T07:27:08.820000Z",
229+
"type": "message",
230+
"text": "Preview of a longer response...",
231+
"author_id": "b5657aff-34dd-32e1-98160d54666df9d8",
232+
"custom_id": "31-0C-1C-07-DB-16"
233+
}
234+
}
235+
```
236+
237+
</CodeResponse>
238+
217239
### `incoming_event`
218240

219241
Informs about an incoming [event](/messaging/customer-chat-api/v3.6/data-structures/#events) sent to a chat.

0 commit comments

Comments
 (0)