Last active
March 14, 2020 15:06
-
-
Save WouterNieuwerth/88eac2ada58065884405b942990cfe69 to your computer and use it in GitHub Desktop.
How to make a POST request from a Google Ads Script to a Google Cloud Function
This file contains 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
// Add your own Cloud Function URL here: | |
var CLOUDFUNCTIONSURL = 'https://europe-west1-example.cloudfunctions.net/example'; | |
function main() { | |
var json = { | |
"example_content": "Whatever you want to send to your Cloud Function", | |
"another_example_content": ["You", "can", "also", "use", "arrays", "here"] | |
}; | |
var options = { | |
method: 'POST', | |
contentType: 'application/json', | |
payload: JSON.stringify(json) | |
}; | |
var response = UrlFetchApp.fetch(CLOUDFUNCTIONSURL, options); | |
Logger.log(response); | |
// Do whatever you want with the response... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment