I’m new to coding Zapier integrations so I am asking a very elementary question: how does my web-app initiate my rest-hook trigger? If that doesn’t make sense I’ll explain below the simple project I’ve setup and how my question fits into it.
- I’ve created an integration, it consists of one (rest-hook) trigger, its an exact copy of Zapiers demo project here: https://github.com/zapier/zapier-platform/tree/master/example-apps/rest-hooks
- I’ve deployed the integration to my account
- I’ve setup some API endpoints in my live web-app, ie, performSubscribe, performUnsubscribe, perform. For example; https://mywebapp.com/subscribe, https://mywebapp.com/unubscribe, https://mywebapp.com/perform
- I then created a test zap - the zap’s trigger is my integration, the zap’s action creates a spreadsheet row in Google Sheets.
My API subscribe endpoint (https://mywebapp.com/subscribe) never received anything. I thought that when someone creates a zap, the endpoint https://mywebapp.com/subscribe is called and then I bundle.targetUrl which is the url I then call when I trigger zaps??? Is that correct?
How does my web-app now trigger my integrations zaps?
const subscribeHook = (z, bundle) => {
const data = {
url: bundle.targetUrl,
style: bundle.inputData.style,
};const options = {
url: 'https://mywebapp.com/subscribe',
method: 'POST',
body: data,
};return z.request(options).then((response) => response.data);
};