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

Custom Media attached to Conversations


(warning)

Warning

For Customers building HIPAA-compliant workflows, Customers are required to ensure that all conversations that have custom media attachment are not accessible without authorization. Conversations may contain sensitive information (PHI), thus you must ensure unauthorized users may not access such information. To learn more about building for HIPAA compliance, please visit the latest requirements here(link takes you to an external page).

Conversations may have Custom Media attached to them that allows the customers to view information related to the conversation after it has ended. Custom Media can point to resources related to the conversation or its segments, such as Chat Transcripts and Call Recordings.

To attach Custom Media to a Conversation, you update the TaskRouter Task and pass specific attributes depending on the type of Custom Media you want to attach. To update the TaskRouter Task, you make an API call to the URL:


_10
https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Tasks/WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Replace WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX with your Twilio Workspace SID, and WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX with the TaskRouter Task's SID. The example below uses curl to call the TaskRouter API URL and passes all the necessary attributes to attach a media link to a Conversation.

Create a Task with Conversations object

create-a-task-with-conversations-object page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_21
// Download the helper library from https://www.twilio.com/docs/node/install
_21
// Find your Account SID and Auth Token at twilio.com/console
_21
// and set the environment variables. See http://twil.io/secure
_21
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_21
const authToken = process.env.TWILIO_AUTH_TOKEN;
_21
const client = require('twilio')(accountSid, authToken);
_21
_21
client.taskrouter.v1.workspaces('WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_21
.tasks
_21
.create({attributes: JSON.stringify({
_21
conversations: {
_21
media: [
_21
{
_21
type: 'Referenced',
_21
url: 'https://externalsystem.com/record-id2',
_21
title: 'External Ticket'
_21
}
_21
]
_21
}
_21
})})
_21
.then(task => console.log(task.sid));

Output

_41
{
_41
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"age": 25200,
_41
"assignment_status": "pending",
_41
"attributes": {
_41
"conversations": {
_41
"media": [
_41
{
_41
"type": "Referenced",
_41
"url": "https://externalsystem.com/record-id2",
_41
"title": "External Ticket"
_41
}
_41
]
_41
}
_41
},
_41
"date_created": "2014-05-14T18:50:02Z",
_41
"date_updated": "2014-05-15T07:26:06Z",
_41
"task_queue_entered_date": null,
_41
"virtual_start_time": "2014-05-14T18:50:02Z",
_41
"priority": 1,
_41
"reason": "Test Reason",
_41
"sid": "WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"task_queue_sid": "WQXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"task_channel_sid": "TCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"task_channel_unique_name": "unique",
_41
"timeout": 60,
_41
"url": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Tasks/WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"workspace_sid": "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"workflow_sid": "WWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"workflow_friendly_name": "Example Workflow",
_41
"task_queue_friendly_name": "Example Task Queue",
_41
"ignore_capacity": false,
_41
"routing_target": "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"addons": {},
_41
"links": {
_41
"task_queue": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/TaskQueues/WQXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"workflow": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workflows/WWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"workspace": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"reservations": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Tasks/WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Reservations"
_41
}
_41
}

If you are looking to use library-specific methods to update the TaskRouter Task, check out Update a Task resource.

(warning)

Warning

Adding media links overrides the references to default call recording and default chat transcript. To reference the original call recording or the original chat transcript together with custom media you need to list the original recording and chat transcript in the media links yourself.


Respond to Drilldowns in Historical Reporting

respond-to-drilldowns-in-historical-reporting page anchor

When users click on a conversation in Flex Insights Flex shows either a call, chat transcript or a list of custom media provided via TaskRouter attributes. Users can change this behavior. The primary use of custom response to drill downs is to respond to Raw media links.


_10
import { Actions } from "@twilio/flex-ui"
_10
_10
Actions.replaceAction("HistoricalReporting:view", async (url, original) => {
_10
_10
// implement your own handling of URL or call original(url) to use the original handler
_10
})

Developers can decide whether they want to handle each drill down themselves or pass it to Flex to handle the drill down. This can be based on the URL that a user clicked or based on any other conditions.


Rate this page: