How to transfer incoming calls on Twilio using webhook to mobile client - ios

We are using Twilio to make outbound calls.
Now we want to add the option for incoming calls, so if a person calls a number we bought from Twilio the mobile client will get the VoIP notification.
We have the webhook and it get called correctly, but what (and how) should we do inside the webhook to transfer the call to the correct mobile user.

Related

Get Whatsapp Number of user in Twilio autopilot

I am trying to create a chatbot using Twilio Autopilot which integrated with WhatsApp. So my flow is like, if user messages on registerd number, Twilio WhatsApp senders webhook will get trigger and it will call Autopilot chatbot task. Task will process the data and it will send reply.
In all above flow I want to capture the WhatsApp number of the user who is asking the question. that number I want in autopilot, so Autopilot will send that number to Twilio function and I want to save that number in my Database using external API's call from Twilio function.
How I will get WhatsApp number inside Twilio Autopilot chatbot for user who is asking questions?
Thanks in Advance
Autopilot can respond using static actions defined within the task, but it can also send a webhook request to fetch Actions JSON from your server. That webhook request contains details about the user you are talking with, including the parameter UserIdentifier which, in a WhatsApp chat, will be the user's WhatsApp number.
If you are currently responding to tasks from Actions JSON defined in the Twilio console, you can add a webhook by using a "redirect" action at the end of a set of actions to a URL you control and then responding to that with a "listen" action to wait for the next task. Alternatively, you could just set a URL for the webhook and respond with your Actions JSON from your own app.

in case of multiple outbound calls, how to identify the call uniquely

I am creating a voice survey application so that the the users can complete the survey over voice using the DTMF inputs.
I am creating multiple calls at a given moment, but i get the call information only when the call connects and the user send the DTMF.
Is there a way, i map the received DTMF input with a unique outgoing call ?
Twilio developer evangelist here.
When you create an outbound call the object that is returned includes a sid property that is the unique identifier for that call resource within Twilio. That sid will be present in the webhook requests as the CallSid parameter. So, if you store the initial call sid against your user somehow, you can always look it up using the information in the incoming webhook request.

Prevent Twilio SMS Instant-Auto-Response "OK"

I have a Twilio integration setup with an application I am building. The application allows users to send and receive text messages to/from a Twilio phone number.
For example, assume you're a user. When you create an account, you receive a phone number -- this phone number is purchased and managed via Twilio. You can then use this phone number to send and receive regular text messages.
To send, it's easy, just make the Twilio API call.
To receive, I'm using the webhook integrations. Meaning, I have a hosted server at https://my-website.com/api/sms/receive. Any time some external person sends a text message to the Twilio phone number, Twilio will send a HTTP POST request to my server.
The problem: Twilio is auto-responding, immediately, to the external persons phone number with OK. I cannot find any documentation about how to prevent this from happening.
I'll provide a real-world use case as an example.
Say Bob is a user of my application. Bob have a Twilio phone number through my app. Bob wants to send a text message to Alice. Alice is not a user of the app -- they're just some external person. Bob is using the app to communication with Alice via Alice's normal phone number.
Bob sends a text to Alice via the Twilio integration
Alice receives the text message on their phone
Alice responds back to Bob's text
Twilio triggers my server webhook integration
Twilio immediately auto-responds back to Alice with OK
(5.) is the problem -- I don't want this to happen
I found the solution. Turns out the webhook API needs to use the TwiML (Twilio Markdown Language) to instruct Twilio not to respond. https://support.twilio.com/hc/en-us/articles/223134127-Receive-SMS-and-MMS-Messages-without-Responding
Specifically, my server just returns a Content-Type of text/html and the body is simply <Response></Response>

Twilio Flex, Intercept Incoming Messages in order to send Slack Notifications

I currently have Twilio Flex set up but need to intercept all incoming messages in order to send slack notifications to reps, if they're offline and need to respond.
Is there a way to intercept (using a webhook) only Incoming messages so that I can send those slack notifications.
Twilio developer evangelist here.
If you go into your Flex project to the Studio dashboard you will find three flows, including the Messaging Flow. Incoming messages are directed to this Flow.
If you open the Messaging Flow you will see that by default it sends the message straight to Flex.
You can add a widget in here to invoke a Twilio Function before sending the message onto Flex. Twilio Functions allow you to write Node.js to perform custom tasks, like sending a Slack notification.

twilio rest API for event registration and listening

I'm using twilio rest API to implement a chat iOS app in objective-c. Though twilio has iOS SDK, I'm required to use rest API only. My question is does anyone know how to use twilio rest API for event registration and listening, such as message sending?
Twilio developer evangelist here.
The Twilio Programmable Chat API uses webhooks to notify your application of incoming messages. Note though that webhooks are not fired for events that are initiated from the REST API. Since you are in control of sending messages via the REST API you should be able to notify other parts of your application when you do so too.

Resources