Home / Companies / Twilio / Blog / Post Details
Content Deep Dive

Build an Inactivity Timeout with Flex Conversations

Blog post from Twilio

Post Details
Company
Date Published
Author
Anton Kushch
Word Count
1,833
Language
English
Hacker News Points
-
Summary

Twilio has released Flex Conversations, which enables more reliable and straightforward orchestration within the Flex ecosystem. To improve productivity for agents, an Inactivity Timeout feature can be implemented using Twilio Functions and the Conversations API. This feature allows automating the tracking of abandoned tasks and cleaning them up when no new messages are sent within a specified timeout period. The solution involves creating two functions, `on_reservation_accepted` and `on_conversation_state_updated`, which interact with the Conversations API to send webhooks and set timers on conversations linked to tasks. After deploying the code to Twilio Functions, the TaskRouter Workspace can be configured to send events to the function, triggering the cleanup process. The solution is tested by simulating agent behavior in Flex, ensuring that the task is automatically completed and a message is sent to the customer when the session times out.