Reputation: 535
I've setup my google app script to be able to send an SMS via Twilio and that all works. I'd like to be able to send an MMS by providing the mediaURL. Not sure what I'm missing here.
function sendSms(to, body) {
var messages_url = "https://api.twilio.com/2010-04-01/Accounts/sidxxxxxxxxxxxxxxxxzxxx/Messages.json";
var payload = {
"To": to,
"Body" : body,
"From" : "+12015551234",
"mediaUrl" : "https://c1.staticflickr.com/3/2899/14341091933_1e92e62d12_b.jpg"
};
var options = {
"method" : "post",
"payload" : payload
};
options.headers = {
"Authorization" : "Basic " + Utilities.base64Encode("sidxxxxxxxxxxxxxx:keyxxxxxxxxxxxxxxx")
};
UrlFetchApp.fetch(messages_url, options);
}
Upvotes: 2
Views: 386
Reputation: 73055
Twilio developer evangelist here.
It looks to me as though your mediaUrl
parameter is wrong. It's a small change that should fix it though.
The parameter should be capitalized. So try it as MediaUrl
instead.
Let me know if that helps at all?
Upvotes: 3