First question: “Does each Rest-hook trigger need a distinct subscription URL?”
No, your API can have a common url to manage subscriptions (and un-subscriptions) for all of your different types of events. However, your API will need a way for the client, your Zapier integration, to tell it which events it’s interested in being notified about for each particular trigger you build. For example, say your API supported events for “New Sale”, “New Return”, and “New Signup”. You might have one endpoint “/subscribe” handle each of those. In the POST payload, for the subscribe request, in your “New Sale” Trigger configuration, you might say `{“event_type”:”New Sale”, “callback_url”: “https://uniquedyanaicallygeneratedurl.here”}`.
The endpoint must return a unique subscription ID. This is needed for the client to unsubscribe when it doesn’t need the event anymore. We’ll call this when the user pauses their Zap.
Another important thing here. Be sure that your event subscription infrastructure can handle multiple subscriptions, for the same event, for the same user. Users will create multiple triggers for the same event, to initiate different workflows. If this fails the resulting error is super confusing for everybody. So please be sure to test this scenario.
Second Question: “Does Zapier provide a unique callback URL for each rest-hook trigger?”
Yes. Each trigger will have a unique endpoint that your event subscription implementation will need to store and associate with the unique subscription ID. We generate that for you and populate it in `bundle.targetUrl`. Map that to whatever field in your API uses to refer to the callback URL for that subscription.
Lots of good info on the pattern here: http://resthooks.org/
Thanks @Zane for the very helpful answer!
For a Django system, it looks like this Zapier library is the way to go, is that correct?
I think that’s probably a good reference implementation to get a quick start from and build on. I’ve not stood that up myself to be able to speak from experience, but a couple of Zapier folks were early committers there.