How to filter out issue updated events done by the addon itself?

Our addon listens to Jira issue updated webhook but also updates issues using REST. I wonder if there’s any way I can write a webhook definition to skip sending us issue updates when the update was done by our addon:

What I’m looking for is JQL that can be used in the descriptor:

webhooks": [
      {
        "event": "jira:issue_updated",
        "url": "/webhooks/issues/updates",
        "filter": "JQL that will filter out issues updated by the addon?"
      },
]

Or any alternative way to achieve it (additional param for issue endpoint)?

I’m dropping those webhooks in the webhook handler already but it would be great not to trigger them at all - would decrease load on Jira and our servers as well.

2 Likes

I did something similar but for issue created event, but it should work similar. Here example:
Filter checks against properties added by addon:

"webhooks": [
      {
        "event": "jira:issue_created",
        "url": "/protected/issue-created",
        "filter": "issue.property[com.deviniti.issue-templates__createdFromTemplate].key is empty AND issue.property[com.deviniti.issue-templates__template].creator is empty",
        "propertyKeys": [
          "createdFromTemplate",
          "templateCreatedDuringOnboarding"
        ]
      },
]

To be able to check against properties you also need to “register” them:

"jiraEntityProperties" : [
      {
        "name" : {
          "value": "Created From Template Property"
        },
        "keyConfigurations" : [
          {
            "extractions" : [
              {
                "alias": "createdFromTemplateName",
                "type": "text",
                "objectName": "name"
              },
              {
                "alias": "createdFromTemplateKey",
                "type": "string",
                "objectName": "key"
              }
            ],
            "propertyKey": "com.deviniti.issue-templates__createdFromTemplate"
          }
        ],
        "entityType" : "issue",
        "key": "created-from-template-indexing"
      },
      {
        "name": {
          "value": "Template property"
        },
        "keyConfigurations": [
          {
            "extractions": [
              {
                "type": "string",
                "objectName": "creator"
              }
            ],
            "propertyKey": "com.deviniti.issue-templates__template"
          }
        ],
        "entityType": "issue",
        "key": "template-property-indexing"
      }
    ]
1 Like

Thanks Maciej, that’s a neat idea but it will not work in my case as the add-on is regularly updating issues, your solution would work for the first call but it will fail later as the property would be already set. I guess I could try to clear the property later (that doesn’t trigger issue updated) but that’s too complicated and could introduce races with updates done by users.