Menu

Park an Interaction

This Twilio product is currently available as a Beta release. Some features are not yet implemented and others may be changed before the product is declared as Generally Available. Use of this Beta release is subject to the relevant terms of the applicable license agreement. Beta products are not covered by a Twilio SLA. Learn more about beta product support.

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.

A channel is deleted after 180 days of inactivity regardless of 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 channel (e.g. adding and removing a participant, or updating the channel status).

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

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

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

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

ROUTING=$(cat << EOF
{
    "properties": {
        "attributes": {
            "from": "+13115552368"
        },
        "workflow_sid": "WWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
        "workspace_sid": "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
    }
}
EOF
)

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

Add a specific agent back to the interaction

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:

ROUTING=$(cat << EOF
{
    "properties": {
        "attributes": {
            "from": "+13115552368"
        },
        "workflow_sid": "WWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
        "workspace_sid": "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
        "queue_sid": "WQXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
        "worker_sid": "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
    }
}
EOF
)

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

Close the interaction channel

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:

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

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

Example Park Application

example park application

Agent Parks an Interaction Channel

agent parks an interaction channel

Customer Sends Message to a Parked Interaction

customer sends message to a parked interaction

Agent Picks up a Parked Interaction Channel

agent picks up a parked interaction channel

Rate this page:

Need some help?

We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd by visiting Twilio's Stack Overflow Collective or browsing the Twilio tag on Stack Overflow.

Thank you for your feedback!

Please select the reason(s) for your feedback. The additional information you provide helps us improve our documentation:

Sending your feedback...
🎉 Thank you for your feedback!
Something went wrong. Please try again.

Thanks for your feedback!

thanks-feedback-gif