Skip to contentSkip to navigationSkip to topbar
Rate this page:
On this page

Park an Interaction


(information)

Info

Flex Conversations requires Flex UI 2.0. If you are on Flex UI 1.x, please refer to Messaging in Flex pages.

Unlike voice channels, digital channels like SMS and chat are asynchronous and last indefinitely, with no clear event indicating the end of a conversation.

Due to this open-ended nature of digital channels, a customer contact or inquiry could stall, and an agent may need to wait for the customer or a back-office personnel to reply in order to continue the conversation. This scenario could persist over several days, or even weeks.

The Interactions API allows you to remove the agent from the channel while leaving the customer in the interaction. In order to follow along, please review the Interactions Resource and the Interaction Channel Participants page for detailed examples.

(information)

Info

An interaction channel (UOXXXXXX) is deleted after 180 days of inactivity, regardless of its state. Retrieving the channel after 180 days from deletion returns a 404 Not Found. Note that the initial TTL (Time to Live) period resets every time there is an update to the interaction channel, such as if an agent accepts the new task through Flex UI. Changes to the Conversations channel, such as updating conversation status or adding or removing a participant, do not reset the interaction channel's inactivity period.

(information)

Info

Make sure to include the original task attributes in your subsequent POST /Invites requests since these attributes are not carried over to the new Task created as a result of sending the Invite.


Remove an agent but keep the interaction open

remove-an-agent-but-keep-the-interaction-open page anchor

To remove an agent, send a POST (update) request to the Participants endpoint.


_10
curl -X POST https://flex-api.twilio.com/v1/Interactions/KDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/UOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Participants/UTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX \
_10
--data-urlencode "Status=closed" \
_10
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN

When a "closed" status is passed, the associated task is completed but the channel, Conversation in this case, remains active.

To re-add an agent, or "unpark/pick up" the interaction, you can use the Invites endpoint to reroute the new task to a specific agent or to specify a workflow for evaluating a suitable queue or agent.


Create a new task and have a workflow evaluate it for routing

create-a-new-task-and-have-a-workflow-evaluate-it-for-routing page anchor

To create a new task for workflow evaluation, send a POST (create) request to the Invites endpoint.


_16
ROUTING=$(cat << EOF
_16
{
_16
"properties": {
_16
"attributes": {
_16
"from": "+13115552368"
_16
},
_16
"workflow_sid": "WWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_16
"workspace_sid": "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_16
}
_16
}
_16
EOF
_16
)
_16
_16
curl -X POST https://flex-api.twilio.com/v1/Interactions/KDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/UOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Invites \
_16
--data-urlencode "Routing=$ROUTING" \
_16
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN



_33
{
_33
"url": "https://flex-api.twilio.com/v1/Interactions/KDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/UOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Invites/KGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_33
"interaction_sid": "KDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_33
"channel_sid": "UOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_33
"routing": {
_33
"reservation": null,
_33
"properties": {
_33
"date_updated": 1636401979,
_33
"age_in_queue": 0,
_33
"task_channel_unique_name": "default",
_33
"assignment_status": "pending",
_33
"queue_name": "Sample Queue",
_33
"assignmentCounter": 0,
_33
"priority": 0,
_33
"sid": "WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_33
"task_queue_entered_date": 1636401979,
_33
"workflow_name": "Default Fifo Workflow",
_33
"workflow_sid": "WWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_33
"routing_target": "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_33
"reason": null,
_33
"attributes": "{\"flexChannelInviteSid\":\"KGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\",\"conversationSid\":\"UOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\",\"channelType\":\"email\",\"conversations\":{\"communication_channel\":\"Email\",\"conversation_id\":\"KDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\",\"media\":[{\"conversation_sid\":\"UOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\",\"media\":[{\"type\":\"ChatTranscript\",\"sid\":\"CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\"}],\"customers\":{\"phone\":\"+13115552368\",\"name\":null,\"email\":null}},\"flexInteractionChannelSid\":\"UOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\",\"flexInteractionSid\":\"KDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\"}",
_33
"task_channel_sid": "TCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_33
"age": 0,
_33
"workspace_sid": "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_33
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_33
"timeout": 86400,
_33
"date_created": 1636401979,
_33
"addons": "{}",
_33
"queue_sid": "WQXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_33
}
_33
},
_33
"sid": "KGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_33
}


Add a specific agent back to the interaction

add-a-specific-agent-back-to-the-interaction page anchor

Alternatively, you can include a queue SID and a Worker SID in your POST Invites request to add a specific agent back to the Interaction:


_18
ROUTING=$(cat << EOF
_18
{
_18
"properties": {
_18
"attributes": {
_18
"from": "+13115552368"
_18
},
_18
"workflow_sid": "WWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_18
"workspace_sid": "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_18
"queue_sid": "WQXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_18
"worker_sid": "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_18
}
_18
}
_18
EOF
_18
)
_18
_18
curl -X POST https://flex-api.twilio.com/v1/Interactions/KDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/UOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Invites \
_18
--data-urlencode "Routing=$ROUTING" \
_18
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN


Close the interaction channel

close-the-interaction-channel page anchor

Once the customer issue has been solved, you can set the status of the interaction channel to closed by sending a POST (update) Interaction Channel request like so:


_10
curl -X POST https://flex-api.twilio.com/v1/Interactions/KDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/UOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX \
_10
--data-urlencode "Status=closed" \
_10
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN

This will set any reservations to the "wrapping" status.


Example Park Application

example-park-application page anchor
example park application.

To try out a working implementation of an interaction park feature, check out the source code in this sample plugin repository(link takes you to an external page).


Agent Parks an Interaction Channel

agent-parks-an-interaction-channel page anchor
agent parks an interaction channel.

Customer Sends Message to a Parked Interaction

customer-sends-message-to-a-parked-interaction page anchor
customer sends message to a parked interaction.

Agent Picks up a Parked Interaction Channel

agent-picks-up-a-parked-interaction-channel page anchor
agent picks up a parked interaction channel.

Rate this page: