Adding a comment to a JIRA ticket directly from confluence page where ticket is linked
Asked by Edd Saunders:

Hi,

I'm looking for a way to automate adding a comment to a JIRA ticket directly from a confluence page.

Context:

\* Use confluence for weekly meeting notes

\* Conflu page has multiple JIRA tickets linked.

\* JIRA tickets will often need additional refinements or information

\* Currently we are adding bullet points of information below each JIRA ticket link, to specify additional context/notes/updates, then copy/pasting this detail into the ticket.

\* I'm looking for a way that confluence can take the info from these bullet points, and add it as a comment to the JIRA ticket it's written below automatically

Thank you

Pictures for context:

1) Notes added in confluence page

![Screenshot 2022-11-25 at 14.42.43.png](https://community.atlassian.com/t5/image/serverpage/image-id/227589i8CE537CA6D7BA848/image-size/large?v=v2&px=999 "Screenshot 2022-11-25 at 14.42.43.png")

2) Notes then added in ticket comment

![Screenshot 2022-11-25 at 14.43.10.png](https://community.atlassian.com/t5/image/serverpage/image-id/227591i35EC5D5113543DC0/image-size/large?v=v2&px=999 "Screenshot 2022-11-25 at 14.43.10.png")


Answers:
author: Darryl Lee
body: Ooooh, this sounds like a job for the (still in early access) [Automation for Confluence](https://community.atlassian.com/t5/Confluence-articles/Introducing-Automation-for-Confluence/ba-p/1978202) (which I missed out on signing up for but ... well, I don't even have a Premium account so meh.)  

But alas, it's not available to us yet. :-{

So then, the other thing I thought of was maybe a Webhook? Jira supports this:

<https://support.atlassian.com/cloud-automation/docs/jira-automation-triggers/#Incoming-webhook>

The trick is ... argh, while Confluence has Webhooks, they are not self-manageable yet. There's a feature request for this: <https://jira.atlassian.com/browse/CONFCLOUD-36613>

In the meantime, a third-party vendor has created a [Webhook Manager for Confluence Cloud](https://marketplace.atlassian.com/apps/1222102/webhook-manager-for-confluence-cloud?hosting=cloud&tab=overview) app which gives you webhooks.

If you have webapp development expertise or resources, you **could** put together your own "app" with the sole purpose of using it to register webhooks, as mentioned here: <https://community.atlassian.com/t5/Confluence-questions/Does-confluence-Cloud-supports-Webhooks/qaq-p/1229110#M161776>

**ANYWHO** , yeah, if you can create a webhook in Confluence, you can use that to trigger an Automation in Jira that would add a comment.  

You'd probably have to do a bit of [text matching](https://support.atlassian.com/cloud-automation/docs/jira-smart-values-text-fields/#match--) to find the correct text from the Confluence update, and then you would use that in the [Comment on issue](https://support.atlassian.com/cloud-automation/docs/jira-automation-actions/#Comment-on-issue) action.

comments: author: Earl McCutcheon
body: Hi All,

[@Dario B](https://community.atlassian.com/t5/user/viewprofilepage/user-id/502402) just added a new workaround to the [CONFCLOUD-36613](https://jira.atlassian.com/browse/CONFCLOUD-36613) feature request that I am reposting below to make sure it gets extra visibility, hope this helps y'all out:

Workaround {#toc-hId--440185275}
--------------------------------

**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,](https://developer.atlassian.com/cloud/confluence/rest/v2/intro/) **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)](https://developer.atlassian.com/cloud/jira/platform/webhooks/#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](https://developer.atlassian.com/cloud/confluence/modules/webhook/).

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

* Execute a DELETE to the following URL: [https://your-domain.atlassian.net/wiki/rest/webhooks/1.0/webhook/\<Webhook-ID\>](https://your-domain.atlassian.net/wiki/rest/webhooks/1.0/webhook/)

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:**

* To get all webhooks (registered using this method) for a Confluence Cloud site, send a GET request to: <https://your-domain.atlassian.net/wiki/rest/webhooks/1.0/webhook>.

Example:  

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

* To get a specific webhook by its ID, perform a GET with the following URL: [https://your-domain.atlassian.net/rest/webhooks/1.0/webhook/\<Webhook-ID\>](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
```


author: VINCENT DUPONT
body: Hello [@Edd Saunders](/t5/user/viewprofilepage/user-id/5087945) ,

did you find any solution fort this? I have exactly the same need  

Thanks

Vincent