Search code examples
twiliotwilio-taskrouter

Transfer call from Twilio auto pilot to Taskrouter?


I am creating Autopilot which greets the user when a Twilio number is called. Then Autopilot will ask the user if he wants to connect with the agent according to the answer of the user. If user say yes then Autopilot will transfer the call to task router. By seeing Twilio example i Have reached to handoff the call to task router.

The problem is that I cannot specify Matching Task. In a Taskrouter workflow, I have 2 to 3 filter I want to pass matching task so that A particular filter is run of the workflow

Currently, I am using the below command For handoff.

"handoff": {
            "channel": "voice",
            "uri": "taskrouter://workflowid",
}

Here I need to able to pass matching task (An addition parameter) something like selected_agent === 'lorem' which will tell the workflow which Particular task(Filter) to run


Solution

  • From the documentation (the Dialogue Payload is a task attribute):

    When handing off an Autopilot voice session to Task Router or Flex, you need to provide the destination the Task Router workflow Sid. When the Hand-off is executed the Autopilot session is terminated, the call is enqueued with the Dialogue Payload as a task attribute.