Skip to content

Commit 84a8eb0

Browse files
authored
Merge pull request #1530 from livechat/API-13700-counters
agent-api: subcribe_customers et consortes
2 parents 1205691 + 3e5da82 commit 84a8eb0

File tree

3 files changed

+136
-2
lines changed

3 files changed

+136
-2
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
@@ -31,6 +31,7 @@ The developer preview version provides a preview of the upcoming changes to the
3131
### Customers
3232

3333
- The **List Customers** method was removed.
34+
- The **Subscribe Customers** ([RTM](/messaging/agent-chat-api/v3.6/rtm-reference/#subscribe_customers)) and **Unsubscribe Customers** ([RTM](/messaging/agent-chat-api/v3.6/rtm-reference/#unsubscribe_customers)) methods along with a [**subscribed_customers_totals_updated**](/messaging/agent-chat-api/v3.6/rtm-pushes/#subscribed_customers_totals_updated) push were added.
3435

3536
### Status
3637

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

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Here's what you need to know about **pushes**:
3535
| **Events** | [`incoming_event`](#incoming_event) [`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
| **Thread tags** | [`thread_tagged`](#thread_tagged) [`thread_untagged`](#thread_untagged) |
38-
| **Customers** | [`incoming_customers`](#incoming_customers) [`incoming_customer`](#incoming_customer) [`customer_updated`](#customer_updated) [`customer_page_updated`](#customer_page_updated) [`customer_banned`](#customer_banned) [`customer_transferred`](#customer_transferred) [`customer_left`](#customer_left) |
38+
| **Customers** | [`incoming_customers`](#incoming_customers) [`incoming_customer`](#incoming_customer) [`customer_updated`](#customer_updated) [`customer_page_updated`](#customer_page_updated) [`customer_banned`](#customer_banned) [`customer_transferred`](#customer_transferred) [`customer_left`](#customer_left) [`subscribed_customers_totals_updated`](#subscribed_customers_totals_updated) |
3939
| **Status** | [`routing_status_set`](#routing_status_set) [`agent_disconnected`](#agent_disconnected) |
4040
| **Configuration** | [`agent_created`](#agent_created) [`agent_approved`](#agent_approved) [`agent_updated`](#agent_updated) [`agent_suspended`](#agent_suspended) [`agent_unsuspended`](#agent_unsuspended) [`agent_deleted`](#agent_deleted) [`auto_accesses_updated`](#auto_accesses_updated) [`bot_created`](#bot_created) [`bot_updated`](#bot_updated) [`bot_deleted`](#bot_deleted) [`group_created`](#group_created) [`group_updated`](#group_updated) [`group_deleted`](#group_deleted) [`tag_created`](#tag_created) [`tag_deleted`](#tag_deleted) [`tag_updated`](#tag_updated) [`groups_status_updated`](#groups_status_updated) [`license_properties_updated`](#license_properties_updated) [`group_properties_updated`](#group_properties_updated) |
4141
| **Other** | [`events_marked_as_seen`](#events_marked_as_seen) [`incoming_sneak_peek`](#incoming_sneak_peek) [`incoming_typing_indicator`](#incoming_typing_indicator) [`incoming_multicast`](#incoming_multicast) [`chat_unfollowed`](#chat_unfollowed) [`queue_positions_updated`](#queue_positions_updated) [`customer_unfollowed`](#customer-unfollowed) |
@@ -678,6 +678,21 @@ Informs that a Customer left the tracked website.
678678

679679
</CodeResponse>
680680

681+
### `subscribed_customers_totals_updated`
682+
683+
Informs that number of customers matching subscription changed. This push is sent periodically once limits are reached.
684+
685+
<CodeResponse title={'Sample push payload'}>
686+
687+
```json
688+
{
689+
"b7eff798f8df43648059649c35c9ed0c": 123,
690+
"a0c22fddfb7140b5bfc6a8a0bc3117f7": 321
691+
}
692+
```
693+
694+
</CodeResponse>
695+
681696
## Status
682697

683698
### `routing_status_set`

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

Lines changed: 119 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ To find sample payloads of **events**, **users**, and **other common structures*
125125
| **Events** | [`send_event`](#send-event) [`send_rich_message_postback`](#send-rich-message-postback) |
126126
| **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) |
127127
| **Thread tags** | [`tag_thread`](#tag-thread) [`untag_thread`](#untag-thread) |
128-
| **Customers** | [`get_customer`](#get-customer) [`create_customer`](#create-customer) [`update_customer`](#update-customer) [`ban_customer`](#ban-customer) [`follow_customer`](#follow-customer) [`unfollow_customer`](#unfollow-customer) |
128+
| **Customers** | [`get_customer`](#get-customer) [`create_customer`](#create-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) |
129129
| **Status** | [`login`](#login) [`set_routing_status`](#set-routing-status) [`set_away_status`](#set-away-status) [`logout`](#logout) [`list_routing_statuses`](#list-routing-statuses) [`update_session`](#update-session) |
130130
| **Other** | [`mark_events_as_seen`](#mark-events-as-seen) [`send_typing_indicator`](#send-typing-indicator) [`multicast`](#multicast) [`list_agents_for_transfer`](#list-agents-for-transfer) |
131131

@@ -2420,6 +2420,124 @@ Removes the agent from the list of customer's followers. Calling this method on
24202420
<Section>
24212421
<Text>
24222422

2423+
### Subscribe Customers
2424+
2425+
Creates a subscription for tracking customers based on the group they belong to. The response will contain customers currently matching the criteria. After a successful subscription, the agent will receive pushes about tracked customers on this RTM connection.
2426+
2427+
If the number of tracked customers exceeds the limit, the `subscribed_customers_totals_updated` push will be periodically sent to indicate the total number of customers matching the criteria at the given moment.
2428+
2429+
#### Specifics
2430+
2431+
| | |
2432+
| ---------------------- | --------------------------------------------------------------------------------------- |
2433+
| **Action** | `subscribe_customers` |
2434+
| **Required scopes** | `customers:ro` |
2435+
| **Web API equivalent** | - |
2436+
| **Push message** | - |
2437+
2438+
#### Request
2439+
2440+
| Parameter | Required | Data type | |
2441+
| --------- | -------- | --------- | --- |
2442+
| `group_ids` | No | `[]int` | |
2443+
| `limit` | No | int | |
2444+
2445+
</Text>
2446+
<Code>
2447+
<CodeSample path={'REQUEST'}>
2448+
2449+
```json
2450+
{
2451+
"action": "subscribe_customers",
2452+
"payload": {
2453+
"group_ids": [0, 42],
2454+
"limit": 100
2455+
}
2456+
}
2457+
```
2458+
2459+
</CodeSample>
2460+
2461+
<CodeResponse>
2462+
2463+
```json
2464+
{
2465+
"request_id": "<request_id>", // optional
2466+
"action": "subscribe_customers",
2467+
"type": "response",
2468+
"success": true,
2469+
"payload": {
2470+
"subscription_id": "b7eff798f8df43648059649c35c9ed0c",
2471+
"customers": [
2472+
// ...
2473+
]
2474+
}
2475+
}
2476+
```
2477+
2478+
</CodeResponse>
2479+
</Code>
2480+
</Section>
2481+
2482+
<Section>
2483+
<Text>
2484+
2485+
2486+
### Unsubscribe Customers
2487+
2488+
Removes a customer subscription.
2489+
2490+
#### Specifics
2491+
2492+
| | |
2493+
| ---------------------- | --------------------------------------------------------------------------------------- |
2494+
| **Action** | `unsubscribe_customers` |
2495+
| **Required scopes** | `customers:ro` |
2496+
| **Web API equivalent** | - |
2497+
| **Push message** | - |
2498+
2499+
#### Request
2500+
2501+
| Parameter | Required | Data type | |
2502+
| --------- | -------- | --------- | --- |
2503+
| `subscription_id` | Yes | string | |
2504+
2505+
</Text>
2506+
<Code>
2507+
<CodeSample path={'REQUEST'}>
2508+
2509+
```json
2510+
{
2511+
"action": "unsubscribe_customers",
2512+
"payload": {
2513+
"subscription_id": "b7eff798f8df43648059649c35c9ed0c"
2514+
}
2515+
}
2516+
```
2517+
2518+
</CodeSample>
2519+
2520+
<CodeResponse>
2521+
2522+
```json
2523+
{
2524+
"request_id": "<request_id>", // optional
2525+
"action": "subscribe_customers",
2526+
"type": "response",
2527+
"success": true,
2528+
"payload": {
2529+
// no response payload
2530+
}
2531+
}
2532+
```
2533+
2534+
</CodeResponse>
2535+
</Code>
2536+
</Section>
2537+
2538+
<Section>
2539+
<Text>
2540+
24232541
## Status
24242542

24252543
### Login

0 commit comments

Comments
 (0)