Hi @ismayil ,
Excellent question!
There are a few options that come to mind.
First, if you’ve not already done so, it might help to add a Perform List function to the trigger. When a Perform List function exists, in the draft/Zap editor, Zapier should fetch existing records to use as samples instead of claiming a temporary subscription:
https://platform.zapier.com/build/resthooks#performlist
Second, bundle.meta includes an isLoadingSample
property, which can be used to check if the request originated from a test in the Zap editor:
https://github.com/zapier/zapier-platform/blob/main/packages/cli/README.md#bundlemeta
Thank you for the answer @connorz. But unfortunately none of them doesn’t help. isLoadingSample is always true. In bundle data there is live key in json, it is also always true. Why does Zapier give different webhook url for draft and live versions?
Hi @ismayil ,
Regarding the creation of multiple webhook URLs, there are a few things worth noting:
- A REST hook subscription should only be created in the Zap editor when the trigger does NOT have a Perform List function.
- If a Perform List function has been created, instead of invoking the Perform Subscribe to create new subscription, the Zap editor should invoke the Perform List function to fetch samples.
- Defining a static sample is also recommended so the Zap editor can offer the user a generic sample when none are returned by the Perform List.
- If no Perform List function exists, the Zap editor will invoke the Perform Subscribe, creating a new subscription with its own webhook URL.
- The subscription created in the Zap editor is temporary and should be deleted automatically via the Unsubscribe function, usually within a few hours.
Overall, the webhook subscriptions created by the Zap editor and by turning the Zap on are different because the one created in the editor is temporary. Whether the user activates the Zap or not, the subscription created in the editor will be garbage collected within a few hours whereas, if the user has turned the Zap on, the webhook created during the activation process will persist as long as the Zap stays on.
@connorz I got it. I did and it works as I expected Thank you for your help