Skip to contentSkip to navigationSkip to topbar
On this page

Park an Interaction


(information)

Info

Flex Conversations requires Flex UI 2.0.x. If you are on Flex UI 1.x.x, refer to the 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.

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

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.

1
ROUTING=$(cat << EOF
2
{
3
"properties": {
4
"attributes": {
5
"from": "+13115552368"
6
},
7
"workflow_sid": "WWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
8
"workspace_sid": "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
9
}
10
}
11
EOF
12
)
13
14
curl -X POST https://flex-api.twilio.com/v1/Interactions/KDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/UOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Invites \
15
--data-urlencode "Routing=$ROUTING" \
16
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
17
18

1
{
2
"url": "https://flex-api.twilio.com/v1/Interactions/KDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/UOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Invites/KGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
3
"interaction_sid": "KDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
4
"channel_sid": "UOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
5
"routing": {
6
"reservation": null,
7
"properties": {
8
"date_updated": 1636401979,
9
"age_in_queue": 0,
10
"task_channel_unique_name": "default",
11
"assignment_status": "pending",
12
"queue_name": "Sample Queue",
13
"assignmentCounter": 0,
14
"priority": 0,
15
"sid": "WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
16
"task_queue_entered_date": 1636401979,
17
"workflow_name": "Default Fifo Workflow",
18
"workflow_sid": "WWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
19
"routing_target": "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
20
"reason": null,
21
"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\"}",
22
"task_channel_sid": "TCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
23
"age": 0,
24
"workspace_sid": "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
25
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
26
"timeout": 86400,
27
"date_created": 1636401979,
28
"addons": "{}",
29
"queue_sid": "WQXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
30
}
31
},
32
"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:

1
ROUTING=$(cat << EOF
2
{
3
"properties": {
4
"attributes": {
5
"from": "+13115552368"
6
},
7
"workflow_sid": "WWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
8
"workspace_sid": "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
9
"queue_sid": "WQXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
10
"worker_sid": "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
11
}
12
}
13
EOF
14
)
15
16
curl -X POST https://flex-api.twilio.com/v1/Interactions/KDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/UOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Invites \
17
--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:

1
curl -X POST https://flex-api.twilio.com/v1/Interactions/KDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/UOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX \
2
--data-urlencode "Status=closed" \
3
-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.

Need some help?

Terms of service

Copyright © 2024 Twilio Inc.