You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/pages/docs/guides/chat/support-chat.mdx
+50-36Lines changed: 50 additions & 36 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ This guide covers both sides of a support chat system with Ably, with particular
12
12

13
13
</div>
14
14
15
-
## Why Ably for support chat?
15
+
## Why Ably for support chat? <aid="why-ably"/>
16
16
17
17
Ably is trusted by organizations delivering chat to millions of users in realtime. The Ably platform is engineered around the four pillars of dependability:
18
18
@@ -23,13 +23,23 @@ Ably is trusted by organizations delivering chat to millions of users in realtim
### Scaling support chat <aid="scaling-support-chat"/>
27
+
26
28
Support chat has unique scaling requirements. You might have thousands of concurrent tickets, each with its own chat room, while each agent handles multiple tickets simultaneously. Ably's architecture scales automatically to handle this load without provisioning or re-engineering as you grow.
27
29
28
30
Delivering chat messages in realtime is key to a smooth online experience. Ably's [serverless architecture](/docs/platform/architecture) eliminates the need for you to manage websocket servers. It automatically scales to handle millions of concurrent connections without provisioning or maintenance. Ably routinely handles 600 billion messages every month globally, across 2 billion devices with a global median [latency](/docs/platform/architecture/latency#message-delivery-latency) of 37ms. Ably also handles all of the edge-cases around delivery, failover and scaling.
29
31
30
32
Ably uses [consistent hashing](/docs/platform/architecture/platform-scalability) to evenly distribute the management of chat rooms across instances, enabling the number of rooms to grow without limit and without causing load spikes. Whether you're managing 100 support chat rooms or 100,000 simultaneous chat rooms, the architecture remains the same.
Network disruption happens - mobile internet loses signal or someone drives through a tunnel. All of Ably's SDKs are designed with this in mind, so that you don't have to handle complicated reconnection logic.
37
+
38
+
If the connection is lost, the Ably SDK libraries [automatically attempt to reconnect](/docs/platform/architecture/connection-recovery) to the servers and resume the position in the message stream. This enables the chat to continue as if the user never left. After extended periods of disconnection, you receive a [discontinuity event](/docs/connect/states#discontinuity), after which the client can use [history](#history) to backfill missing messages.
39
+
40
+
It's rare, but sometimes a client might lose connection to a particular data center. Ably operates in multiple data centers around the world with multiple fallback regions available. If a client can't reach the nearest data center, it tries the next one until the connection is re-established, ensuring minimal downtime. Ably's [fault tolerance guide](/docs/platform/architecture/fault-tolerance) describes how this works and shows that even if an entire region goes down, it has little-to-no impact on the global service and your application.
A support chat system has a straightforward core architecture: **one room per ticket**. The key decisions involve the flow of support tickets through the system and the customer and agent experience:
35
45
@@ -63,7 +73,15 @@ Use both Ably Pub/Sub and the Ably Chat SDK to build a support chat system. The
63
73
- Create a dedicated chat room for agents across the whole system, team, or department.
64
74
- Use presence in this chat room to share agent availability and workload with the rest of the team.
If you use React, the [Chat React UI Kit](/docs/chat/react-ui-kit) provides ready-made components for building chat interfaces. It is a great fit for building both the customer-facing chat widget and the agent dashboard, or just one of them.
79
+
80
+
Drop in the [App](/docs/chat/react-ui-kit/components#app) component to see a working chat UI within minutes, or use individual components like [ChatWindow](/docs/chat/react-ui-kit/components#chat-window), [ChatMessageList](/docs/chat/react-ui-kit/components#chat-message-list), [MessageInput](/docs/chat/react-ui-kit/components#message-input), and [ParticipantList](/docs/chat/react-ui-kit/components#participant-list) to build custom interfaces.
81
+
82
+
Components handle message display with history loading, editing and deletion, reactions, typing indicators, and presence. [Providers](/docs/chat/react-ui-kit/providers) manage themes, avatars, and chat settings. See the [getting started guide](/docs/chat/getting-started/react-ui-kit) for setup details.
Building a polished chat widget requires handling message delivery guarantees, reconnection logic, presence synchronization, and typing indicators. Ably Chat abstracts away these challenges, so you can focus on the user experience rather than the infrastructure. Customers interact with one room at a time, typically through an embedded widget.
69
87
@@ -81,6 +99,26 @@ You can add a pre-chat flow to collect information before connecting to the room
81
99
82
100
After the chat has started, you can provide a rich chat experience with the Ably Chat SDK. It requires minimal setup and provides a comprehensive set of features out of the box. See the [embedded chat guide](/docs/guides/chat/build-embedded-chat) for implementation patterns.
Name each support chat room uniquely by using the user ID as a prefix followed by the ticket ID. For example, `support:user-343:ticket-992`.
105
+
106
+
This approach allows you to grant permission for users to access all their own support tickets, even before they are created, making authentication and access control straightforward. Grant each customer a JWT with access to their own support tickets by using a capability resource specifier such as `support:user-343:*`.
107
+
108
+
Example capabilities for a customer:
109
+
110
+
<Code>
111
+
```json
112
+
{
113
+
"support:user-343:*": [
114
+
"publish",
115
+
"subscribe",
116
+
"presence"
117
+
]
118
+
}
119
+
```
120
+
</Code>
121
+
84
122
### Typing indicators <aid="typing-indicators"/>
85
123
86
124
[Typing indicators](/docs/chat/rooms/typing) are a common feature in most chat applications. They show when someone is actively composing a message, helping to:
@@ -168,7 +206,7 @@ while (true) {
168
206
169
207
### Presence: see when agents and customers are online <aid="presence"/>
170
208
171
-
[Presence](/docs/chat/rooms/presence) shows who is currently active in the room, enabling you to bring more live context to your application. You can display in realtime when an agent joins the room, along with their status, such as "Available" or "Gathering context, will join shortly".
209
+
[Presence](/docs/chat/rooms/presence) shows who is currently active in the room, enabling you to bring more live context to your application. You can display in realtime when an agent joins the room, along with their status, such as "Available" or "Gathering context, will join shortly". You can also display to the agent if the customer is still active, and attach information about the customer.
172
210
173
211
Beyond online or offline status, presence can include rich information about the user, such as their name, avatar, role, and other details.
174
212
@@ -196,26 +234,6 @@ await room.presence.leave();
196
234
197
235
Presence can also be used to share data about the current user to the support agent, such as what page they are currently on, to assist them better with their query.
Name each support chat room uniquely by using the user ID as a prefix followed by the ticket ID. For example, `support:user-343:ticket-992`.
202
-
203
-
This approach allows you to grant permission for users to access all their own support tickets, even before they are created, making authentication and access control straightforward. Grant each customer a JWT with access to their own support tickets by using a capability resource specifier such as `support:user-343:*`.
The [React UI Kit](/docs/chat/react-ui-kit) provides ready-made components for building chat interfaces. Drop in the [App](/docs/chat/react-ui-kit/components#app) component to see a working chat UI within minutes, or use individual components like [ChatWindow](/docs/chat/react-ui-kit/components#chat-window), [ChatMessageList](/docs/chat/react-ui-kit/components#chat-message-list), [MessageInput](/docs/chat/react-ui-kit/components#message-input), and [ParticipantList](/docs/chat/react-ui-kit/components#participant-list) to build custom interfaces.
216
-
217
-
Components handle message display with history loading, editing and deletion, reactions, typing indicators, and presence. [Providers](/docs/chat/react-ui-kit/providers) manage themes, avatars, and chat settings. See the [getting started guide](/docs/chat/getting-started/react-ui-kit) for setup details.
218
-
219
237
## Assigning tickets to agents
220
238
221
239
A key part of a support system is assigning tickets to agents. You can do this on your server either in advance as tickets are created, by tracking agent workload, or by broadcasting all tickets to all agents in a shared queue.
@@ -326,11 +344,11 @@ Each attachment maintains a subscription with new messages, typing indicators, a
326
344
327
345
### Agent presence and availability <aid="agent-presence"/>
328
346
329
-
Agents need to signal their availability across the entire support application, not just individual rooms.
347
+
Agents need to signal their status and availability with other agents, for the whole application or their team. This is separate to the presence information displayed to customers. We call this app-wide presence, even though it can be scoped to a team or department.
330
348
331
-
**App-wide presence** uses a dedicated channel (for example, `support:agents`) where agents enter presence when they sign in and update their status (available, busy, away) and current workload. Other agents and routing systems can see who is online and available.
349
+
**App-wide presence** uses a dedicated channel (for example, `support:agents`, or `support:agents-sales`) where agents enter presence when they sign in and update their status (available, busy, away) and current workload. Other agents and routing systems can see who is online and available.
332
350
333
-
**Room-level presence**shows the customer that their agent is present. When an agent opens a ticket room, they enter presence with their role and name, providing reassurance that help has arrived. Agents can also see if customers are still active.
351
+
This is different to the **room-level presence**which connects the agent to individual chat rooms and customers. When an agent opens a ticket room, they enter presence with their role and name, providing reassurance that help has arrived. Agents can also see if customers are still active.
334
352
335
353
### Push notifications for agents <aid="push-notifications"/>
336
354
@@ -340,7 +358,7 @@ Agents aren't always watching the dashboard. You can use Ably to send [push noti
340
358
- Mentions from other agents.
341
359
- Customer activity on tickets assigned to them.
342
360
343
-
## AI integrations
361
+
## Adding AI to the loop
344
362
345
363
AI chatbots are revolutionizing the way we interact with digital platforms. Integrating an AI agent (such as an LLM) into your support chat flow can reduce the workload for your agents and provide faster responses to customers. AI can also help support agents be more effective by providing contextual information and suggested responses. Additionally, AI can help you analyze past chats for training, monitoring, and building knowledge bases.
346
364
@@ -375,13 +393,6 @@ AI can assist agents in several ways:
375
393
376
394
Implement this client-side in the agent dashboard, where each message from the chat is passed to your backend or AI service as it arrives. The responses can be rendered in a sidebar where the agent can review, copy and paste, or read the information to help answer the customer's questions faster.
377
395
378
-
## Handling network disruption
379
-
380
-
Network disruption happens - mobile internet loses signal or someone drives through a tunnel. All of Ably's SDKs are designed with this in mind, so that you don't have to handle complicated reconnection logic.
381
-
382
-
If the connection is lost, the Ably SDK libraries [automatically attempt to reconnect](/docs/platform/architecture/connection-recovery) to the servers and resume the position in the message stream. This enables the chat to continue as if the user never left. After extended periods of disconnection, you receive a [discontinuity event](/docs/connect/states#discontinuity), after which the client can use [history](#history) to backfill missing messages.
383
-
384
-
It's rare, but sometimes a client might lose connection to a particular data center. Ably operates in multiple data centers around the world with multiple fallback regions available. If a client can't reach the nearest data center, it tries the next one until the connection is re-established, ensuring minimal downtime. Ably's [fault tolerance guide](/docs/platform/architecture/fault-tolerance) describes how this works and shows that even if an entire region goes down, it has little-to-no impact on the global service and your application.
385
396
386
397
## Ticket resolution and archiving <aid="ticket-resolution"/>
387
398
@@ -406,11 +417,14 @@ For more sophisticated export patterns such as continuous ingestion and streamin
406
417
407
418
Before you go live with your support chat, review these key points:
408
419
409
-
***Authentication strategy:** Ensure you're using token authentication for all client-side communication with appropriate capabilities for each participant.
420
+
***Authentication strategy:** Ensure you're using token authentication for all client-side communication with appropriate capabilities for each participant. Make sure capabilities are configured correctly for each type of participant (agents and customers).
410
421
***Scale planning:** Confirm you are on the right Ably package for your expected volume of concurrent tickets.
411
422
***Error handling:** Implement proper error handling for network disruptions and ensure graceful degradation.
412
423
***Data retention:** Verify your message history retention policy aligns with your compliance requirements.
413
424
***Export strategy:** Set up a process for archiving closed tickets to your long-term storage.
425
+
***AI integrations:** Ensure AI integrations are configured correctly and are ready to handle the expected volume of messages.
426
+
***Push notifications:** Test push notifications in all scenarios and all supported platforms.
0 commit comments