Created
February 12, 2025 15:11
-
-
Save Sammeeey/422350ac2d7a82f24792821bd6920eea to your computer and use it in GitHub Desktop.
Apps Script to trigger Make.com scenario via Google Forms submission (via webhook module)
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
// source: https://www.youtube.com/watch?v=z4CUu5bBy6Y | |
var POST_URL = "<enter your webhook URL>"; | |
function onSubmit(e) { | |
var form = FormApp.getActiveForm(); | |
var allResponses = form.getResponses(); | |
var latestResponse = allResponses[allResponses.length - 1]; | |
var response = latestResponse.getItemResponses(); | |
var payload = {}; | |
for (var i = 0; i < response.length; i++) { | |
var question = response[i].getItem().getTitle(); | |
var answer = response[i].getResponse(); | |
payload[question] = answer; | |
} | |
var options = { | |
"method": "post", | |
"contentType": "application/json", | |
"payload": JSON.stringify(payload) | |
}; | |
UrlFetchApp.fetch(POST_URL, options); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment