Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save WouterNieuwerth/88eac2ada58065884405b942990cfe69 to your computer and use it in GitHub Desktop.
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
// 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