Creating Jira Webhooks - jqlFilter not working as expected

Hi there
I am trying to create a webhook via the following API:

https://<my domain>.atlassian.net/rest/webhooks/1.0/webhook

I am using the following payload:

{
    "userName": "john.smith@gmail.com",
    "domain": "workdrum.atlassian.net",
    "data": {
        "name": "Workdrum Issues created and updated webhook",
        "url": "https://workdrumdev.au.ngrok.io/issuewebhook",
        "events": [
            "jira:issue_created",
            "jira:issue_updated",
            "jira:issue_deleted"
        ],
        "jqlFilter": "project = 'Workdrum Kanban'",
        "excludeIssueDetails": false
    }
}

For some reason the jqlFilter property is not being adhered to and the webhook is setup with a filter of “all issues”. The filter doesnt seem to be getting applied. Has anyone else experienced this?

Any help would be greatly appreciated.

Hi @AdamMoroff, the JQL looks to be valid. The single quotes work in Jira’s API, but maybe they’re causing a problem? Have you tried using the project key to avoid the need to use quotes? e.g. project = WK? Alternatively, try escaping double quotes.

Thanks @dmorrow - Ive tried using the project key, removing the quotes and escaping the quotes to no avail. Everything else seems to work except the jqlFilter. The response Im getting back is:

{
          "name": "Workdrum Issues created and updated webhook",
          "url": "https://workdrumdev.au.ngrok.io/jira/issuewebhook",
          "excludeBody": false,
          "filters": {
            "issue-related-events-section": ""
          },
          "events": [
            "jira:issue_updated",
            "jira:issue_created",
            "jira:issue_deleted"
          ],
          "enabled": true,
          "self": "https://workdrum.atlassian.net/rest/webhooks/1.0/webhook/16",
          "lastUpdatedUser": "admin",
          "lastUpdatedDisplayName": "Adam Moroff",
          "lastUpdated": 1589948535168
        }

I can see the filters object has a property called issue-related-events-section and its blank. Am I missing something in the request??

Hi @AdamMoroff ,
Did you manage to resolve this? I’m experiencing the same issue

Hi,

the reason why you are facing troubles with registering webhooks with jqlFilter is a bug in our docs.

The expected shape of the POST request is:

{
  "name": "My first webhook via rest",
  "url": "http://www.example.com/webhooks",
  "events": [
    "jira:issue_created",
    "jira:issue_updated"
  ],
  "filters": {
        "issue-related-events-section": "JRA AND resolution = Fixed"
  },
  "excludeIssueDetails" : false
}

I’ve just pushed the doc fix, but it will be released in 2022, I guess.

Have a great festive season!

Additionally, may I ask what is stopping you from the usage of different approaches to register webhooks like dynamic webhooks?