Content for body in webhooks while registering through dynamic module in Jira Cloud

Hi all,

I am trying to register a webhook inside my Node.js app for Jira issue delete event through dynamic module API (https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-dynamic-modules/#api-rest-atlassian-connect-1-app-module-dynamic-post). I am unsure about the content of the body to create a webhook. Would be really great if someone could help me with this.

Thanks in advance.

The easiest payload should look like:

{
   "webhooks" : [
      {
        "event": "jira:issue_created",
        "url": "/issue-created",
        "filter": "project = HSA",
      }
    ]

If you are looking for more detailed documentation, please refer to this page.

Hi @BeataSzturemska ,

Thanks for responding. I think I get the idea of the payload data format. Just a follow up question, how will the API trigger upon the app installation or how do I call the API? Do I have to define a route for it with another endpoint, something like:

app.post("/some-path", (req, res) => {
    AP.request(
        {
           method: "POST",
           url:"/rest/atlassian-connect/1/app/module/dynamic"
           json: body
        }
    )
});

Thanks.

I would say it depends on your use case.

You can call this endpoint, once installed lifecycle event is received, but in that use case you can define a webhook in the manifest as well.

The second approach is calling some internal API in your app, as you suggested. It is beneficial especially if you need any user input ie. in order to create a JQL filter - a project name or key.

Hope it helps.