javascript - How to send Values to Maker Channel on IFTTT with google scripts? -
i trying use ifttt maker channel create new text file in dropbox, using google apps script. mapped "value1" , "value2" body of file. here sample code, without api key.
function sendfiletomaker(){ var makerkey = 'app_key'; var eventname = 'test_event'; var url = 'https://maker.ifttt.com/trigger/' + eventname + '/with/key/' + makerkey; var payload = { "value1" : "test", "value2" : "testfile" }; var options = { "method" : "post", "contenttype": "json", "payload":payload, }; logger.log(urlfetchapp.fetch(url,options)); }; the trigger runs, values not seem recognized. "congratulations! you've fired test_event event", seem if did not error, file creates empty.
what doing worng? how fix it?
i found did wrong. if take out content type, call works. edited function easier use.
function sendtomaker(makerkey,eventname,value1,value2,value3){ var url = 'https://maker.ifttt.com/trigger/' + eventname + '/with/key/' + makerkey; var payload = { 'value1' : value1, 'value2' : value2, 'value3' : value3 }; var options = { 'method' : 'post', 'payload':payload, }; return urlfetchapp.fetch(url,options) }; you can send text through maker channel, or download urls can add files google drive dropbox.
Comments
Post a Comment