Skip to content

Handling active chat when agent sets status to Offline in Amazon Connect

0

I’m working with Amazon Connect and trying to handle a specific real-time scenario for chat contacts.

When an agent is currently handling an active chat and manually changes their status to Offline, Amazon Connect keeps the chat session active until the contact ends. However, for my use case, I want to intervene earlier.

My requirement:

  • If an agent sets their status to Offline during an active chat, I want to:

    • Either transfer the contact back to a queue, or
    • move the contact to a disconnect flow (for CSAT and cleanup)

What I’ve implemented so far:

  • Using Kinesis Data Streams (Agent Events) → Lambda to detect when NextAgentStatus = Offline

  • From Lambda, identifying active chat contacts for the agent

  • Explored different APIs:

    • TransferContact → not supported for CHAT contacts
    • StopContact → disconnects both agent and customer (not desired)
    • DisconnectParticipant → requires participant token (not available in backend)
  • Currently exploring UpdateContactAttributes + Contact Flow logic as a workaround

My questions:

  1. Is there any native or recommended way in Amazon Connect to transfer or reroute an active chat contact when an agent sets their status to Offline?
  2. Is using contact attributes + flow-based routing the only supported approach for this scenario?
  3. Are there any best practices for handling this kind of real-time agent state change in chat (without disconnecting the customer)?

Any guidance or recommended architecture would be really helpful.

1 Answer
0

Based on Amazon Connect's architecture, when an agent sets their status to Offline while handling an active chat, the system enters a "Next status: Offline" state. In this state, Amazon Connect stops routing new contacts to the agent but allows them to complete their current active chats. Once all their slots are cleared, the system automatically sets their status to Offline.

For your specific requirement to intervene earlier and transfer the chat when an agent goes Offline, here's what's supported:

Native Approach:

The recommended way to handle chat transfers when an agent disconnects is through disconnect flows. When an agent leaves a chat (which would occur when they go Offline and the chat ends), you can configure a disconnect flow that:

  1. Uses a Set disconnect flow block in your inbound flow to specify which disconnect flow should run when the agent disconnects
  2. In the disconnect flow, add a Wait block with two branches:
  • Customer return: Routes the customer when they send a message - you can route them to the previous queue, a new queue, or back to the original agent
  • Timeout: Handles the scenario if the customer doesn't respond within a specified time

This approach allows the chat to continue and be reassigned rather than being terminated. The total duration of the chat, including multiple Wait blocks, cannot exceed 7 days.

For Your Use Case:

Since you want to transfer the contact before it naturally ends, using contact attributes combined with flow-based routing is indeed the most viable approach within Amazon Connect's current capabilities. You can:

  1. Use your Lambda function (triggered by Kinesis Agent Events) to update contact attributes when detecting NextAgentStatus = Offline
  2. Have your contact flow logic check these attributes and trigger appropriate routing decisions
  3. Use the disconnect flow mechanism to handle the transfer once the agent actually disconnects

Important Note:

There isn't a direct API to forcibly transfer an active chat contact away from an agent in real-time while they're still connected. The disconnect flow approach is designed to handle the transition gracefully after the agent disconnects, which aligns with Amazon Connect's asynchronous chat model where customers can resume conversations.

The contact attributes + flow-based routing approach you're exploring is the appropriate method for implementing custom logic around agent state changes in chat scenarios without abruptly disconnecting customers.
Sources
The chat/SMS channel in Amazon Connect - Amazon Connect
Set your "Next status" in the Contact Control Panel (CCP) - Amazon Connect
Sample disconnect flow in Amazon Connect - Amazon Connect

answered 2 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.