Forward Twilio MMS Messages Using Twilio Resources - twilio

I am trying to use Twilio to forward SMS and MMS messages to multiple phone numbers using Twilio recourses. I followed the online documentations and got SMS forwarding up easily. But I did not find any documentation on forwarding MMS messages.
What is the proper method to forward an MMS message using Twilio recourses? This will be working off of US based phone numbers.
I took a stab at it using a function and I can get the media URL to be forwarded but it then requires the receiver to log into Twilio to view the image.
`exports.handler = function(context, event, callback) {
let twiml = new Twilio.twiml.MessagingResponse();
twiml.message(`${event.From}: ${event.MediaUrl0}: ${event.Body}`, {
to: '+19999999999'
});
callback(null, twiml);
};`
I can see I will also have a problem when more than 1 image is forwarded in the message and have to obtain the message image count.

I'm not exactly sure why the receiver is having to log in to Twilio to view the image. But to answer your second question, if more than 1 image is forwarded, you'll have to access them such that the MediaURL parameter is structured as MediaUrl0, MediaUrl1, MediaUrl2 and etc. MediaUrl0 is the first image in the MMS and MediaUrl1 is the second. And there can be a maximum of 10 images per MMS. Source

Related

Twilio : sender does not support reply. allowed domestic only. how make it reply able from any number?

I have Trial account of Twilio. When I send a SMS it does not support reply but I want the receiver to be able to reply as well. In Twilio console I can see that it supports receive SMS from domestic number only. How can make it possible to receive from any number. Thats possible in Trial account right? Or can I change the region for now to test replies from other numbers? I am using a simple node js code to send SMS.
function sendSMS(from, to, body) {
client.messages.create(
{
to, // Recipient's number
messagingServiceSid: TWILIO_MESSAGING_SERVICE_SID, // Twilio Messaging SID
body, // Message to Recipient
},
(error, message) => {
if (error) {
fail(error);
} else {
//success({ to, body });
console.log('message sent');
}
}
);
}
Twilio developer evangelist here.
We provide guidelines for how messaging is supported in different countries, you can read the SMS guidelines for Nepal here.
Twilio does not support domestic numbers in Nepal, so you can only send messages to Nepal from an international number, like the US number you currently have. However, normally due to country level restrictions, when you send a message from an international number the sender ID is not preserved. That is, the message will appear to come from a different number/short code/alphanumeric ID than the one you sent it from. For this reason, if a user tries to reply to that message the message may fail to send or just won't be directed back to Twilio.
If you, or your user, takes your US number and sends an SMS message directly to it, you will receive that though.

Make an outgoing call to a number and listen for responses

I would like to initiate an outgoing call from twilio to a number provided by a service like nexmo and be able to listen to the response.
Based on the voice message back from the receiver, i would like to determine my response
I have gone through the documentation, and from what i can make out, the outgoing call does not give me an access to the incoming stream. The Call object allows me to control the call, but not based on the voice response
client.calls
.create({
url: 'http://demo.twilio.com/docs/voice.xml',
to: '+15558675310',
from: '+15017122661'
})
.then(call => console.log(call.sid));
The call object does not provide me a way to access the conversation audio.
Overall, I would like the call to be initiated and my caller program to get access to the response voice messages that it can parse and then determine the next response.
Should i consider SIP for this scenario, since the destination number will also be having a SIP endpoint?
I was able to achieve this with the standard Twiml
The Gather verb of twilio will wait to receive voice packet and then perform speech recognition on it and send back the text.
In response to this callback, i am sending back the next audio to play and immediately followed by the next Gather.

Twilio Studio: send response message based on incoming message content

I already have a Twilio application with this use case :
The incoming message is forwarded to a client
The client replies to the message by sending a message to the twilio number. The message body will contain the phone number at the beginning followed by the message content.
The web hook checks if the message is received from the client and it contains a phone number. If so, it forwards the message to the phone number in the body.
I would like to implement this use case using Twilio studio.
Is this possible?
You can use the Split widget and use a regular expression to test whether the input from Step 2 contains a phone number or not.

Is it possible to send twilio SMS text messages to landline phones (text-to-speech?)

Outbound messages only - It appears that it can be done from a mobile phone by adding the 10-digit landline number to the SMS message.
Twilio evangelist here.
What you can do is take a text message that has been sent to a Twilio phone number, use our REST API to initiate an outbound phone call to the landline, then when the call is answered use out TTS engine to read the text message to the caller.
Some resources:
Receiving an incoming text message
Making an outbound phone call
TwiML <Say> Verb
Hope that helps.

Can you initiate a phone call by sending an SMS message using twilio?

As the title states what I would like to do is be able to text a number and have that number initiate a phone call.
is this possible with Twilios API?
yes; Twilio will make a request to the SMS url that you specify when it receives a SMS. You can initiate the phone call in the logic on the page that the SMS url points to.
check out http://www.twilio.com/docs/api/twiml/sms/twilio_request
Yes. You configure an SMS endpoint for your application / telephone number. When someone SMS's that number, Twilio will request the endpoint and the logic you have on that page can initiate a Telephone Call.

Resources