API functions.

nti.webhooks.api.subscribe_in_site_manager(site_manager, subscription_kwargs, utility_name='WebhookSubscriptionManager')[source]

Produce and return a persistent IWebhookSubscription in the given site manager.

The subscription_kwargs are as for nti.webhooks.interfaces.IWebhookSubscriptionManager.createSubscription(). No defaults are applied here.

The utility_name can be used to namespace subscriptions. It must never be empty.

nti.webhooks.api.subscribe_to_resource(resource, to, for_=None, when=<InterfaceClass zope.interface.interfaces.IObjectEvent>, dialect_id=None, owner_id=None, permission_id=None)[source]

Produce and return a persistent IWebhookSubscription based on the resource.

Only the resource and to arguments are mandatory. The other arguments are optional, and are the same as the attributes in that interface.


The resource to subscribe to. Passing a resource does two things. First, the resources is used to find the closest enclosing ISite that is persistent. A IWebhookSubscriptionManager utility will be installed in this site if one does not already exist, and the subscription will be created there.

Second, if for_ is not given, then the interfaces provided by the resource will be used for for_. This doesn’t actually subscribe just to events on that exact object, but to events for objects with the same set of interfaces.