Task polling

Every interaction in Twilio Flex generates an object called a task, and every task contains a variety of attributes to store information about the interaction. A great deal of information about a Twilio Flex task can be obtained through the attributes of the task object.

One the main features of the Twilio Flex integration is the automatic scheduling of surveys after a task has occurred in the Twilio Flex environment. Each time an agent completes a task, Twilio Flex can pass the attributes of the task to Mindful Feedback. Mindful then maps the attributes to its own task variables that can be assessed in survey mapping conditions. If an attribute matches a survey mapping condition, Mindful schedules a survey automatically.

Twilio Flex Tasks and Task Variables

To get started, it is important to understand the attributes available in a Twilio Flex task. The following screenshot shows task attributes being assigned in a Twilio Studio Flow prior to sending calls to agents.

Screen capture of task attributes being assigned in a Twilio Studio Flow

When the Studio Flow executes this block, a task object will be created with a variety of attributes. Expand the content below to view attributes for an example task object.

{
  "attributes": {

     "my_CustomerName:" "Alexander"

     "my_external_ref": "CA3a6..."

     "my_phone_number": "+61404873642"

     "my_respondent_language": "en-US"

     "my_survey_sip_token": "7fd830d0-7efd..."

    "account_sid": "ACbd1..."

     "api_version": "2010-04-01"

     "call_sid": "CA3a65..."

     "called": "+61731844087"

     "called_city": ""

     "called_country": "AU"

     "called_state": "Queensland"

     "called_zip": ""

     "caller": "+61404873642"

    "caller_city": ""

   " caller_country": "AU"

     "caller_state": ""

     "caller_zip": ""

     "direction": "inbound"

    "from": "+61404873642"

     "from_city": ""

     "from_country": "AU"

     "from_state": ""

     "from_zip": ""

     "mySurveyType": "inbound"

     "myVoiceSurvey": "1"

    "to": "+61731844087"

     "to_city": ""

     "to_country": "AU"

     "to_state": "Queensland"

     "to_zip": ""

    "type": "inbound"

    },

     "dateCreated": "2020-07-16T03:34:08.000Z",

    "dateUpdated": "2020-07-16T03:36:15.000Z",

     "priority": 0,

     "queueName": "General Enquiries",

     "queueSid": "WQ8eaa...",

     "reason": null,

    "sid": "WT1f7d5...",

     "status": "wrapping",

     "taskChannelUniqueName": "voice",

     "taskChannelSid": "TC...",

     "timeout": 86400,

     "workflowName": "Assign to Anyone",

     "workflowSid": "WW4d8...",

     "incomingTransferDescriptor": null,

     "outgoingTransferDescriptor": null,

     "reservationSid": "WR39..."

We recommend viewing a task object in your own Twilio Flex environment to familiarize yourself with the available attributes. This can help you to fully take advantage of Mindful Feedback survey mappings.

Note: When creating a survey mapping, you are not limited to using the list of task variables presented in the dropdown menus. You can use any attribute from the attributes property of the task object. In the example above, you can see attributes such as my_CustomerName, mySurveyType, and my_respondent_language listed in the attributes property. You could access any of these in a survey mapping by referencing the attribute name.