Need to register a webhook through webhook API but got error

Khushal Singh April 27, 2023

HI,

I am trying to register a webhook using webhook URL to get notifications, which is suggested in doc "<CONFLUENCE_URL>/rest/api/webhooks",

But at my side its not working giving error like 

Oops, you've found a dead link. while using URL "https://khushal94.atlassian.net/confluence/rest/api/webhooks/"

& in second case i am trying this URL "https://khushal94.atlassian.net/confluence/rest/api/webhooks/" which is giving 404 null,

Please suggest what i'm doing wrong here,

Thanks in advance

2 answers

0 votes
pavel.susloparov
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 3, 2024

Based on the https://developer.atlassian.com/cloud/confluence/modules/webhook/ documentation, I can register a webhook against confluence events. 

The documentation here: https://developer.atlassian.com/server/confluence/webhooks/

does not specify `/wiki` in the URL path for the confluence events.

 

Thank you Earl for your reply, live saver, truly.

0 votes
Alex Koxaras _Relational_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 30, 2023

Hi @Khushal Singh and welcome to the community,

Please read this post https://community.atlassian.com/t5/Confluence-questions/Does-confluence-Cloud-supports-Webhooks/qaq-p/1229110

  1. In Confluence Cloud Webhooks can only be registered through the descriptor file of an add-on, not from the UI
  2. There is an open feature request to ask for the possibility to manage Webhooks through the UI: [CONFCLOUD-36613] Allow Confluence Webhook Administration
Earl McCutcheon
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 28, 2023

Hi All,

@Dario B just added a new workaround to the CONFCLOUD-36613 feature request that I am reposting below to make sure it gets extra visibility, hope this helps y'all out:

Workaround

WARNING!

There is one security concern regarding webhooks created using the way explained below: even though they can only be created by admins, there are no other permissions checks. If a regular user creates a restricted page, admins won't be able to access it via Confluence UI/API, but they will be able to receive webhooks related to this page. The information of course is very limited, but they will be able to see a title of a page, for example. We fixed this for regular webhooks a couple of years ago, but here it's not possible since there is no user to check permissions against.

 

There exists a private API that can be used for this purpose. However, the endpoint discussed below is intended for internal use only. Therefore, it is not part of the official Confluence Cloud REST APIs, it is not supported and it can change without any notice.

Once this has been said: you can register, list or delete Webhooks in Confluence Cloud by using the internal REST API endpoint /wiki/rest/webhooks/1.0/webhook.

The endpoint works the same way as the /rest/webhooks/1.0/webhook endpoint documented for Jira Cloud in the Webhook documentation page, section: Registering a webhook using the Jira REST API (Other integrations)

 

To register a webhook using REST:

  1. Send a POST request using below format to: https://your-domain.atlassian.net/wiki/rest/webhooks/1.0/webhook
    {
      "name": "Webhook (test comment created)",
      "url": "https://www.example.com/webhooks",
      "events": [
        "comment_created"
      ]
    } 
  1. The response will return the webhook in JSON with additional information, including the user that created the webhook, the created timestamp, etc.

For a complete list of events, etc, please refer to the Confluence Cloud Webhook documentation page.

 

To unregister (that is, delete) a webhook using REST:

Example:
The following would delete the webhook with an ID of 70:

curl --user EmailAddress:ApiToken -X DELETE -H "Content-Type: application/json" https://your-domain.atlassian.net/wiki/rest/webhooks/1.0/webhook/70

 

To query a webhook using REST:

Example:

curl --user EmailAddress:ApiToken -X GET -H "Content-Type: application/json" https://your-domain.atlassian.net/rest/webhooks/1.0/webhook

 

Example: the following would get a webhook with an ID of 72

curl --user EmailAddress:ApiToken -X GET -H "Content-Type: application/json" https://your-domain.atlassian.net/rest/webhooks/1.0/webhook/72
Like pavel.susloparov likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events