Documentation
Webhooks
A webhook is a standard mechanism for implementing HTTP callbacks. Atlassian OnDemand applications can execute webhooks that your add-ons can use to be notified of certain events that happen in JIRA or Confluence.
Just to give you an idea of how you can use them in add-ons, here are a few sample webhook events:
- When an add-on is enabled or disabled
- When an issue is created or closed in JIRA
- When a page is created or updated in Confluence
Handling the webhook event
To receive webhook events, your add-on needs to include the webhook module declaration in its JSON descriptor. The declaration indicates the relative URL of the local resource at which it will receive the notification. In other words, the Atlassian application will send an HTTP POST to this resource in response to an application event. The add-on code that handles the POST should process any information passed in the body of the message, as appropriate. Each webhook POST sent to the add-on will also include the authentication headers that allow the add-on to validate the authenticity of that request.
Webhook event types
Below is a list of all available webhook events.
Jira Webhook events
connect_addon_disabledconnect_addon_enabledjira-webhook-post-functionjira:issue_createdjira:issue_deletedjira:issue_updatedjira:worklog_updatedplugin_enabledplugins_upgradedremote_issue_link_aggregate_cleared_eventremote_plugin_disabledremote_plugin_enabledremote_plugin_installedremote_workflow_post_functionserver_upgraded
Confluence Webhook events
attachment_createdattachment_removedattachment_updatedattachment_viewedblog_createdblog_removedblog_restoredblog_trashedblog_updatedblog_viewedcache_statistics_changedcomment_createdcomment_removedcomment_updatedconnect_addon_disabledconnect_addon_enabledgroup_createdgroup_removedlabel_addedlabel_createdlabel_deletedlabel_removedloginlogin_failedlogoutpage_children_reorderedpage_createdpage_movedpage_removedpage_restoredpage_trashedpage_updatedpage_viewedplugin_enabledplugins_upgradedremote_plugin_disabledremote_plugin_enabledremote_plugin_installedsearch_performedserver_upgradedspace_createdspace_logo_updatedspace_permissions_updatedspace_removedspace_updatedstatus_clearedstatus_createdstatus_removeduser_createduser_deactivateduser_followeduser_reactivateduser_removed
Inspecting webhook contents
Each type of webhook event includes information specific to that event in the body content of the POST message. The add-on resource that listens for webhook posts should receive and process the content as appropriate for the add-on. To understand what type of content each webhook generates, you can use the webhook inspector tool.
The Webhook Inspector is a atlassian-connect-express Connect add-on that you can install in your development environment to inspect the content of event messages. The Webhook Inspector subscribes and generates each webhook event type available on the running instance of the Atlassian application, and prints the body posted by the instance to the console screen.
Example
{
"modules": {
"webhooks": [
{
"event": "jira:issue_created",
"url": "/issue-created"
}
]
}
}
Properties
event
Type
stringRequired
Description
Specifies the named event you would like to listen to (e.g., "enabled", "jira:issue_created", etc.)
url
Type
stringuriRequired
Description
Specifies your add-on's POST webhook handler URL. This property has to be a relative URL.
params
Type
objectDescription
This object represents a map of key/value pairs, where each property name and value corresponds to the parameter name and value respectively.
Example
{
"params": {
"someOtherProperty": "someValue",
"myCustomProperty": "myValue"
}
}