Created
April 1, 2019 03:50
-
-
Save mskian/96c5385cef64ca99de7994387348e2a6 to your computer and use it in GitHub Desktop.
Google APP Script - Google Form Submit Notifications to Pushbullet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function onFormSubmit(e) { | |
var url = "https://api.pushbullet.com/v2/pushes"; | |
var responses = ' '; | |
var form = FormApp.openById('<FormID>'); // https://docs.google.com/forms/d/FormID/edit | |
var formResponses = form.getResponses(); | |
var formResponse = formResponses[formResponses.length - 1]; | |
var itemResponses = formResponse.getItemResponses(); | |
var customerNameresponse = itemResponses[0]; | |
var mrrresponse = itemResponses[2]; | |
responses = responses + customerNameresponse.getResponse(); | |
var data = { | |
"title": "Google Forms Notification", | |
"body": "New Submission From" + responses + " on Your Blog", | |
"type": "note" | |
} | |
var options = { | |
"method": "post", | |
"headers": { | |
"Access-Token": "<Pushbullet API KEY>", //Pushbull API Key - https://docs.pushbullet.com/ | |
"Content-Type": "application/json" | |
}, | |
"payload": JSON.stringify(data) | |
}; | |
var response = UrlFetchApp.fetch(url, options); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment