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.
Flex Insights (also known as Historical Reporting) is currently available as a public beta release and the information contained in the Flex Insights documentation is subject to change. This means that some features are not yet implemented and others may be changed before the product is declared as generally available. Public beta products are not covered by a Twilio SLA.
Any reference to "Historical Reporting," "Flex Insights API," "Flex Insights Historical Reporting," or "Flex Insights Historical Reporting API" in the Flex Insights documentation refers to Flex Insights.
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:
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.
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function createTask() {11const task = await client.taskrouter.v112.workspaces("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")13.tasks.create({14attributes: JSON.stringify({15conversations: {16media: [17{18type: "Referenced",19url: "https://externalsystem.com/record-id2",20title: "External Ticket",21},22],23},24}),25});2627console.log(task.accountSid);28}2930createTask();
1{2"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"age": 25200,4"assignment_status": "pending",5"attributes": "{ \"conversations\": { \"media\": [ { \"type\": \"Referenced\", \"url\": \"https://externalsystem.com/record-id2\", \"title\": \"External Ticket\" } ] } }",6"date_created": "2014-05-14T18:50:02Z",7"date_updated": "2014-05-15T07:26:06Z",8"task_queue_entered_date": null,9"virtual_start_time": "2014-05-14T18:50:02Z",10"priority": 1,11"reason": "Test Reason",12"sid": "WTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",13"task_queue_sid": "WQaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",14"task_channel_sid": "TCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",15"task_channel_unique_name": "unique",16"timeout": 60,17"url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Tasks/WTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",18"workspace_sid": "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",19"workflow_sid": "WWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",20"workflow_friendly_name": "Example Workflow",21"task_queue_friendly_name": "Example Task Queue",22"ignore_capacity": false,23"routing_target": "WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",24"addons": "{}",25"links": {26"task_queue": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TaskQueues/WQaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",27"workflow": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workflows/WWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",28"workspace": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",29"reservations": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Tasks/WTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Reservations"30}31}
If you are looking to use library-specific methods to update the TaskRouter Task, check out Update a Task resource.
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.
Each segment can have multiple media links related to it. You can provide links on the task level and/or on the reservation level.
Example TaskRouter attributes structure for task-level media links:
1{2"conversations": {3"media": [4// media links list goes here5]6}7}
Example TaskRouter attributes structure for reservation-level media links:
1{2"reservation_attributes": {3"<reservation_sid_1>": {4"media": [5// media links list goes here6]7}8}9}
Raw media links are passed as-is to Historical Reporting. This means that when you drill down, the link is opened in a new browser tab or you can respond to clicks on that link and create custom drill down behavior in Flex.
1{2"conversations": {3"media": [4{5"type": "Raw",6"url": "https://company.com/record-id",7"title": "CRM Conversation Record"8}9]10}11}
Embedded media links can display a custom webpage on the Conversation Screen in an iFrame. This type of media link is useful for referencing tickets, CRM records and similar content related to the conversation. The web application that you embed has to support unique URLs for records that you are interested in so you can point to the content directly related to a conversation.
1{2"conversations": {3"media": [4{5"type": "Embedded",6"url": "https://company.com/tickets/ticket-id",7"title": "Support Ticket"8}9]10}11}
Note Some web applications do not enable embedding for their content, or require configuration on their side to enable embedding. In case a web application does not enable embedding, use the referenced media link type instead.
Referenced media links are useful for linking to external web pages related to a conversation. Referenced media links are shown as links in Conversation Screen.
1{2"conversations": {3"media": [4{5"type": "Referenced",6"url": "https://externalsystem.com/record-id",7"title": "External Ticket"8}9]10}11}
Voice Recording Media Links reference voice call recordings that users can playback and listen to in case they need to drill down to a conversation.
1{2"conversations": {3"media": [4{5"type": "VoiceRecording",6"url": "https://exampleurl.com",7"start_time": 1574350320000,8"channels": [9"customer",10"others"11],12"title": "Dual channel recording"13}14]15}16}
Note When call recording is enabled in Flex, you do not typically have to provide a link to a voice recording.
The start_time attribute needs to be in milliseconds (i.e. 1574350320000).
Chat Transcript media link references a chat transcript made by Twilio Programmable Chat.
1{2"conversations": {3"media": [4{5"type": "ChatTranscript",6"sid": "CHxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"7}8]9}10}
Media link lists can have multiple items in them. When users drill down to a conversation with multiple media attached to them, they can switch between them.
In the following case there is a specific behavior for media links:
Conversation Screen
does not open. The Raw media link is open in a new browser window/tab. The other media links are not accessible from Flex user interface.
The following example shows multiple media links in a conversation. The Conversation Screen will offer users to switch between the chat transcript and the embedded content.
1{2"conversations": {3"media": [4{5"type": "Embedded",6"url": "https://company.com/ticket-id",7"title": "Support Ticket"8},9{10"type": "ChatTranscript",11"sid": "CHxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"12},13{14"type": "VoiceRecording",15"url": "https://exampleurl.com"16}17]18}19}
Multiple VoiceRecording media links is not currently supported in Flex. Only the first one on the list will be visible in the player.
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.
1import { Actions } from "@twilio/flex-ui"23Actions.replaceAction("HistoricalReportingView", async (url, original) => {45// implement your own handling of URL or call original(url) to use the original handler6})
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.