Skip to content

Instantly share code, notes, and snippets.

@iaindooley
Last active June 7, 2021 03:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iaindooley/c344cc62c08858736ce18e8cf920c44e to your computer and use it in GitHub Desktop.
Save iaindooley/c344cc62c08858736ce18e8cf920c44e to your computer and use it in GitHub Desktop.
Example custom webhook
function myFunction(notification)
{
var ret = false;
try
{
var payload = JSON.parse(notification.postData.contents);
//this function should inspect the notification somehow
if(isShopifyNotification(payload))
{
ret = true;
//Implement this function to do the stuff you actually need to do
processShopifyNotificationSomehow(payload);
}
}
catch(e)
{
ExecutionQueue.push("myFunction",notification,"failed Shopify",Trellinator.now());
Trellinator.log("myFunction Exception: "+e);
flushInfoBuffer();
}
return ret;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment