使用Twilio的MMS使用Google App脚本不起作用

时间:2018-10-24 18:09:22

标签: google-apps-script twilio twilio-api

我正在尝试使用Google App脚本和Twilio发送彩信。由于某些原因,Twilio没有发送MMS。没有错误被记录。除了我从未收到图像外,一切似乎都按预期运行。我想念什么吗?

function sendText() {

  var messagesUrl = "https://api.twilio.com/2010-04-01/Accounts/AC88563f5e7f405a10c6caa109002d8ac8/Messages.json";

  var payload = {
    "To": '+11234567890',
    "Body" : 'hello',
    "mediaUrl": 'https://c1.staticflickr.com/3/2899/14341091933_1e92e62d12_b.jpg',
    "From" : "+11234567890"

  };

  var options = {
    "method" : "post",
    "payload" : payload
  };
  options.headers = {    
    "Authorization" : "Basic " + Utilities.base64Encode("YOURACCOUNTSID:YOURAUTHTOKEN")
  };

  var value = UrlFetchApp.fetch(messagesUrl, options);
  Logger.log(value)

}

这是我得到的答复

{
  "sid": "SMccaca54f12754f1691ad7af61bbc6dc",
  "date_created": "Wed, 24 Oct 2018 17:42:23 +0000",
  "date_updated": "Wed, 24 Oct 2018 17:42:23 +0000",
  "date_sent": null,
  "account_sid": "AR88563f5e7f301a10c6cba109112d8ac8",
  "to": "+11234567890",
  "from": "+11234567890",
  "messaging_service_sid": null,
  "body": "hello",
  "status": "queued",
  "num_segments": "1",
  "num_media": "0",
  "direction": "outbound-api",
  "api_version": "2010-04-01",
  "price": null,
  "price_unit": "USD",
  "error_code": null,
  "error_message": null,
  "uri": "/2010-04-01/Accounts/AR88563f5e7f301a10c6cba109112d8ac8/Messages/SMcaaca81f20754f1691ad7afc71bbc6dc.json",
  "subresource_uris": {
    "media": "/2010-04-01/Accounts/AR88563f5e7f301a10c6cba109112d8ac8/Messages/SMcaaca81f20754f1691ad7afc71bbc6dc/Media.json"
  }

0 个答案:

没有答案