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

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

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: