Webhooks for your CKAN. For example, as an app developer you want to be notified when a dataset your app depends on is updated. This extension allows users and services to register to be notified for common CKAN events, such as:
Subscribers provide a callback url when registering for an event, and CKAN will call that url when the desired event happens.
Add webhooks to your CKAN plugins:
ckan.plugins = ... webhooks
The extension pushes webhook notifications onto the CKAN celery queue, so that the web app won’t block executions while the webhooks are firing. For this reason you need to make sure the celery daemon is running:
paster --plugin=ckan celeryd -c development.ini
Or if you are using datacats:
At the moment there is no web interface to create Webhooks. Please make one if you’re up for it! For now, hooks must be registered through the action API. For example:
import ckanapi ckan = ckanapi.RemoteCKAN('http://some.ckan.org') #create webhook hook = ckan.action.webhook_create(topic="dataset/create", address="http://example.com/callback") #show webhook ckan.action.webhook_show(id=hook) #delete webhook ckan.action.webhook_delete(id=hook)
There is a minimal authentication as you may restrict creation of webhooks to users who are editors or administrators of organisations. You may add a config option to your CKAN file as below where the value is one of editor, admin, sysadmin or none, specifying the minimum roles required to be able to interact with webhooks.
# Only let sysadmins create hooks ckanext.webhooks.minimum_auth = sysadmin
# Only let admins and editors create hooks ckanext.webhooks.minimum_auth = editor
Some other notes: