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

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

Output

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

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("HistoricalReportingView", 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: