Skip to main content

I'm developing a public integration that includes a REST hook, and I’d like to implement error handling in the performSubscribe method to provide feedback message to the end user if the subscription endpoint fails. Is this possible?

So far, I’ve validated non-200 status codes returned by the request, but when testing on the platform, it allows the Zap to turn on and then turns it off a few seconds later without any feedback.

Here the code:

const subscribeHook = async (z, bundle) => {  
const options = {
url: "<endpoint>",
body: data,
skipThrowForStatus: true
};

const response = await z.request(options);

if (response.status != 200) {
throw new z.errors.Error("User-friendly message", "SubscriptionError", response.status);
}

return response.data;
};

 

Or is it possible to use the performList method to return a message to the user during the 'Test' step of the trigger configuration?

Be the first to reply!

Reply