Twilio how to connect Autopilot to a Studio flow - twilio

I have set up a demo Twilio studio flow which can process a loan via text or voice. I would now like to put an autopilot in front of it to chat to the user to identify they want a loan and then pass them to my studio flow.
Ideally this would be seemless but I suppose it could pass details from the autopilot to the studio and perform a call back. Is either approach possible?

As of May 23, 2019 Studio has added Autopilot widget support.
Here is a blog that has the details of how to use it.

Twilio developer evangelist here.
I've had a look around and it doesn't look like there is a dedicated Autopilot Studio widget yet.
I've not spent much time with Autopilot myself yet, but a look over the docs suggests that you can maybe use the Autopilot Query endpoint from an HTTP request Studio widget. The Query endpoint returns JSON which can be parsed and read by other widgets in Studio.
Let me know if that helps at all.

Related

How to use Twilio API to create a Twilio Function (or any other Twilio built-in service) that forwards incoming calls?

In my app, the users see a list of Twilio numbers.
I simply want to give the user the ability to specify a "forward number" for each of these numbers, and my app would call the Twilio API to set this up properly.
I understand that I can give each Twilio number a webhook, which returns TwiML that can facilitate the forward.
But because call forwarding is such a basic feature (the app has no needs to configure anything other than this), I was thinking, Twilio must have something built-in for me so that I don't have to host such a webhook just for call forwarding?
So I looked into the docs and found:
TwiML bins: snippets of TwiML directly hosted in Twilio – but can be created by console only and not API, useless for my scenario.
Twilio Studio: basically their IVR builder. Does seem to have API access. But I only need basic forward and have zero use for call flows etc, so this seems completely overkill?
Twilio function: this appears to be what I want. Twilio hosted functions that do not require self-hosted webhooks. It even has built-in templates for call forwarding in the console. But how do I create and update these programmatically via API so that I can pass in the numbers to forward to? From what I can see in the runtime API, functions can be created/updated with only the basic name/sid properties, so they're essentially empty functions? I do see this FunctionVersionContent API but it seems to be read only?
I'm lost at this point. Is there an API in Twilio I can call to set up basic call forwarding on a Twilio number that's all taken care of on Twilio's side, a feature that is provided to customers of basically any phone service?
Twilio developer evangelist here.
There are multiple ways to forward calls with Twilio APIs! And the great thing about APIs is that you can customize the solution to how you wish. I'd recommend looking at setting up call forwarding that references Studio, TwiML Bins, Webhooks, and Functions, this docs page on call forwarding with Studio, this blog post on call forwarding with Studio.
You can update Twilio Functions via the Twilio Serverless Toolkit as well! Let me know if this helps at all!
Figured it out from Twilio support. This can be done via query parameters with TwiML bins or Twilio Functions.
Even though TwilML bins cannot be created/edited with API, each bin has a URL that can be used as a webhook. So defining one bin like this:
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Dial>{{forwardTo}}</Dial>
</Response>
Then update the VoiceUrl to use https://url.to.bin?forwardTo=e164number
This only works if numbers are provisioned in the same account as the TwiML bin. If the numbers are provisioned in subaccounts, we can use public Twilio functions instead.

Twilio Flex stream audio over websocket

I am trying to stream audio when an agent picks up call on a flex dashboard. Although one can start streaming when working with twilio APIs. But I didn't find any docs related to this usecase.
Twilio developer evangelist here.
You can insert the fork stream widget into the Studio flow that leads to a Flex agent?
[edit]
As requested, the media stream should join when the call is accepted by an agent. I don't think you can do this in Studio, so you would have to implement this as a Flex plugin. When the plugin detects that a call has been accepted by an agent it could make a request using the call SID to modify the call and inject the <Start><Stream> TwiML.
I don't have more detail on that right now, as I've not built that sort of thing myself. Let me know if this helps.

Is it like If I am using Twilio Flex, then I only have to customize the UI and build the API from scratch?

If I am using Twilio flex then do I need to build the API from scratch and can customize the UI according to me.
Means can I build API of my own? And I don't need to build my own UI, just customize that which is provided by flex.
Twilio developer evangelist here.
When you are building with Flex you can absolutely add your own endpoints so you can call other services from the UI. I've done this before using Twilio Functions, but as long as the URL can respond to HTTP requests you can host it anywhere.
This is a good way to customise Flex to extend it outside of the Twilio API.

API for running modeler flow?

my customer wants to run modeler flow with date and time specified.
I know a schedule function of modeler flow is not provided with Watson Studio.
So, I'm looking for API to run modeler flow.
Do you have any APIs to run modeler flow like following URL?
https://medium.com/ibm-watson/using-shell-scripts-to-control-data-flows-created-in-watson-applications-f7de2e265f1f
Thanks in advance.
No, there is not yet a public API available for modeler flows in Watson Studio. This is something we will support in the future, but please submit your idea here to let us know what you would like to see and let others vote on your idea.

How to call Google Assistant API from the Dialogflow webhook?

In webhooks from Dialogflow, is there a way to trigger Google Assistant APIs, get back the result and display in Dialogflow?
Thanks.
Short answer: no. The Assistant API currently only takes voice input, and there is no way to get the user's voice in Dialogflow. In theory, you could run it through a TTS, feed that to the API, get the response back, and feed that through STT, but that seems like a pain.
What are you actually trying to do?
Google Assistant webhook will not make your bot more intelligent. You need to create right intents in your Dialogflow Agent to make it intelligent enough to do Natural Language Processing and trigger the right intent. Whatever webhook you create (Google Assistant or other) they will just work as you have coded.
In short, Dialogflow is doing the NLP stuff and making your bot intelligent and webhook will do tasks based on the identified intent or action.
To integrate GA with Dialogflow, best way would be to use NodeJS client for Action-on-Google and add it to your webhook project like require('actions-on-google').DialogflowApp
Follow the documentation and understand how to create a GA webhook for Dialogflow.
It would be better if you can explain exactly what you want to do. That way, the community members can answer your question in a better way.

Resources