Webhooks allow you to notify an application, or other external service, when certain events occur in Confluence. For example, you can configure webhooks to update an issue tracker, or trigger notifications in a chat tool.
On this page:
A webhook consists of:
- One or more events – such as page creation, or space removed. You can select multiple events to trigger the webhook.
- A URL – the endpoint where you want Confluence to send the event payloads when a matching event happens.
Once created, Confluence will listen for these events, and send the event payload, in JSON format, to the URL you specified.
Securing the webhook
Confluence uses webhook secrets to authenticate the payload. Combined with HTTPS, it helps ensure the message transmitted is the one that Confluence intended to send, and that the contents were not tampered with.
When you define a secret for a webhook, each request is signed via a Hash-based Message Authentication Code (HMAC). The default for this algorithm is HMACSha256. The header X-Hub-Signature is defined and contains the HMAC.
To authenticate the validity of the message payload, the receiver can perform the HMAC algorithm on the received body with the secret as the key to the HMAC algorithm. If the results don't match, it may indicate there was a problem with transmission that has caused the message payload to change.
Create a new webhook
You need Confluence Administrator or System Administrator global permissions to create a webhook.
To create a new webhook:
- Go to Administration > General Configuration >Webhooks.
- Enter a title for your webhook.
- Enter the URL of the application or server.
- Enter a secret. This is a string of up to 255 characters that you define.
- Select Test connection to check you can reach the application or server.
- Choose the events that should trigger the webhook.
- Select Active to make your webhook available immediately.
- Select Create.
Screenshot: Creating a webhook to notify a chat application when a space is created or removed.
You can also create a webhook using the API. See Webhooks in the Confluence developer documentation.
You can configure your webhook to be triggered by the following events.
|a file is attached to a page or blog post
a file is deleted (sent to the trash) from the attachments page
(not triggered when a version is deleted from the file history)
|a file is restored from the trash
|a file is purged from the trash
|a new file version of is uploaded directly or by editing the file
|a blog post is published
|a blog post is deleted (sent to the trash)
|a blog post is restored from the trash
|a blog post is purged from the trash
|a blog post is edited
|a page is created from a blueprint (such as meeting notes, decision, or how-to)
|a page comment, inline comment or file comment is made
|a page comment, inline comment, or file comment is deleted
|a page comment, inline comment, or file comment is edited
|a page, blog post, attachment (file), comment (page, inline, or file), or other file (such as a space logo) is created or uploaded.
|a page, blog post, or attachment (file) is restored from the trash
|a page, blog post, or attachment (file) is purged from the trash
|a page, blog post, attachment (file), or comment (page, inline, and file) is edited.
|a view or edit restriction is applied or removed from a page or blog post
|a new group is created
|a group is deleted
|an existing label is applied to a page, blog post, or space
a label is added for the first time (did not already exist)
|a label is removed from the last page, blog post, or space, and so ceases to exist
|a label is removed from a page, blog post, or space
the default ordering of pages is changed to alphabetical in the Space Tools > Reorder pages tab
(is not triggered when you drag a page, or move a page, to change the page order)
a page is published for the first time, including pages created from a template or blueprint
|a page is moved to a different position in the page tree, to a different parent page, or to another space
|a page is deleted (sent to the trash)
|a page is restored from the trash
|a page is purged from the trash
|a page is edited (triggered at the point the unpublished changes are published)
|a new space is created
|a new file is uploaded for use as the logo of a space
space permissions are changed in the Space Tools > Permissions tab
(is not triggered when you edit space permissions using Inspect Permissions)
|a space is deleted
|the space details (title, description, status) is updated in the Space Tools > Overview tab
|a specific theme or default theme is applied to to a space or the whole site
|a new user account is created
|a user account is disabled
|someone follows a user
|a disabled user account is enabled
|a user account is deleted
Here's an example of the event payload for the
page_trashed event. This is the raw data that's sent, in JSON format, to your endpoint.
You'll note that the content is comprised mostly of IDs. This is to ensure that identifiable information is not stored by third party services, or leaked to users who do not have permission to see it.
Once received, you can use the REST API to interpret these IDs. See Confluence Server Rest API.
To help protect your Confluence site, any webhooks that fail consistently, are skipped for a period of time. By default, if a webhook fails five times, it is considered unhealthy and is skipped, initially for 10 seconds. If it continues to fail, it will be gradually shipped for longer periods, up to 10 hours.
A webhook may also be skipped if there are too many webhooks in flight. If there are 500 webhooks being invoked, further requests will be skipped until the number in flight drops below 500.