Google Apps Script make HTTP POST

后端 未结 4 1514
北荒
北荒 2021-01-02 06:56

I would like to make an HTTP POST using google apps script. I have found very little documentation on this, maybe someone could kindly help?

The HTTP POST will be to

4条回答
  •  借酒劲吻你
    2021-01-02 07:36

    i managed to do it, here's the code:

    var url = "https://api.twilio.com/2010-04-01/Accounts/ ...account.SID... /SMS/Messages.json";
    var options = {
        "method": "post",
        "headers": {
            "Authorization": "Basic " + Utilities.base64Encode(" ...account.SID... : ...auth.token... ")
        },
        "payload": {
            "From": "+12025551212",
            "To": "+14155551212",
            "Body": "Test from Google Apps Script"
        }
    };
    var response = UrlFetchApp.fetch(url, options);
    

提交回复
热议问题