Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Webhooks not triggered

Artiom Vasiliev August 9, 2021

Hello there,

I've looked through every similar topic here in the forums, and couldn't really find anything that would help me.

I've built 3LO integration with my product, and adding webhooks via rest API. Hooks are created and I can list them:

[{'id': 10002,
'jqlFilter': 'project = "STAG" AND issuetype = Epic',
'events': ['jira:issue_updated', 'jira:issue_created', 'jira:issue_deleted'],
'expirationDate': '2021-09-08T15:45:58.616+0300'},
{'id': 10003,
'jqlFilter': 'project = "STAG"',
'events': ['jira:issue_updated', 'jira:issue_created', 'jira:issue_deleted'],
'expirationDate': '2021-09-08T15:51:37.608+0300'},
{'id': 10004,
'jqlFilter': 'issuetype = Epic',
'events': ['jira:issue_updated', 'jira:issue_created', 'jira:issue_deleted'],
'expirationDate': '2021-09-08T16:12:31.343+0300'}] 

Made 3 similar looking webhooks as I thought I had a problem with jql, however when I execute it I get the correct list of epics.

Whenever I try to update, delete, or create an epic, nothing happens. Not getting any callbacks from Jira.

For the sake of testing I am using https://requestbin.net service which works fine (sent it several requests and saw them in the log).

1 answer

0 votes
Dario B
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 12, 2021

Hello @Artiom Vasiliev ,

If I understand correctly, you have created some Webhooks using JQL filters via REST API and they are correctly created, but are not fired.

If my understanding is correct, can you kindly let me know the following:

  1. Is project STAG a Team or a Company managed project?
  2. Can you navigate to the Jira Webhooks administration page (https://[NAME].atlassian.net/plugins/servlet/webhooks#) and check whether the webhooks are listed in there and are marked as active?
  3. What happens if you create a Webhook with the same JQL filter from the UI (the webhook administration page mentioned above)? Does it work as expected?
  4. What happens if you try to create a Webhook WITHOUT any JQL filter via REST API (for 3LO apps, by using POST /rest/api/2/webhook)?
  5. Finally, can you try to fetch the list of the webhooks configured in your site by using the REST API endpoint for other integrations (being already authenticated in Jira, you can just paste https://[NAME].atlassian.net/rest/webhooks/1.0/webhook in your browser address bar) as well as the one for  3LO apps (GET /rest/api/2/webhook) and paste the output in here?   

 

Otherwise, in case my understanding is not correct, please provide more details.

 

Cheers,
Dario

Artiom Vasiliev August 16, 2021

Hi Dario, thanks for a detailed reply. Here's the info:

  1. The STAG project is a company-managed project
  2. After programmatically creating a new webhook (POST to https://api.atlassian.com/ex/jira/<cloud id>/rest/api/2/webhook endpoint) and receiving success JSON back ( {'webhookRegistrationResult': [{'createdWebhookId': 10005}]} ), navigating to the system webhooks returned an empty page, ie "No WebHooks are configured."
  3. Successfully added webhooks with the exact JQL from the UI, however it didn't trigger anything either. I also tried to list webhooks programmatically (using GET on https://api.atlassian.com/ex/jira/<cloud id>/rest/api/2/webhook) and received only a single webhook that I created programmatically in the previous step. Couldn't see the one I did via UI.
    I tried to add an all-inclusive webhook via UI clicking all of the events and leaving the JQL empty (to match all issues), but that didn't help. No events were triggered.
  4. I cannot add a webhook without JQL, so the bare minimum I did was to use "issuetype = Epic". This didn't trigger anything.
  5. Using the /rest/webhooks/1.0/webhook endpoint I can see the all-inclusive system webhook I've added previously in step 3:
    [{"name":"New Webhook Listener","url":"https://requestbin.net/r/e7q4yq4l","excludeBody":false,"filters":{"issue-related-events-section":""},"events":["worklog_created","option_unassigned_issues_changed","comment_updated","user_created","attachment_created","jira:version_created","board_configuration_changed","issue_property_set","project_deleted","sprint_created","comment_deleted","option_issuelinks_changed","project_updated","jira:issue_updated","project_archived","issue_property_deleted","sprint_updated","option_voting_changed","comment_created","option_timetracking_changed","project_soft_deleted","option_attachments_changed","jira:issue_created","issuelink_deleted","jira:issue_deleted","sprint_deleted","project_restored_deleted","attachment_deleted","project_created","option_watching_changed","issuelink_created","jira:version_unreleased","board_created","jira:version_moved","project_restored_archived","sprint_closed","user_updated","jira:version_released","jira:version_deleted","option_timetracking_provider_changed","sprint_started","jira:version_merged","worklog_deleted","option_subtasks_changed","jira:version_updated","worklog_updated","user_deleted","board_updated"],"enabled":true,"self":"https://getshipit.atlassian.net/rest/webhooks/1.0/webhook/4","lastUpdatedUser":"shipzdik","lastUpdatedDisplayName":"Artjom Vassiljev","lastUpdated":1629105245598}
    Doing the same for 3LO app, I get a different list of webhooks, the ones I created programmatically:
    [{'id': 10006,
    'jqlFilter': 'project = STAG AND issuetype = Epic',
    'events': ['jira:issue_updated', 'jira:issue_created',
    'expirationDate': '2021-09-15T12:10:00.781+0300'},
    {'id': 10007,
    'jqlFilter': 'issuetype = Epic',
    'events': ['jira:issue_updated', 'jira:issue_created',
    'expirationDate': '2021-09-15T12:11:56.384+0300'}]

     

I couldn't find any information whether webhooks is available on specific plans only or on free as well. We're on the free plan, but most of our clients for whom we're doing the integration are on paid plans.

Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 17, 2021

Hi @Artiom Vasiliev 

Allow me to step in for Dario while he is away.  Thanks for providing all these details, it really helps to see the scope of the problem here.  I came across a documented bug here over in https://jira.atlassian.com/browse/JRACLOUD-67911 that I think relates to this problem.

It appears that the documentation we have regarding the json formatting for how a JQL filter is created programmatically is currently incorrect.  Please note that the JQL for this kind of webhook now appears to be slightly different than the JQL used within Jira for making that search.

So for example, your payload contains the string:

'jqlFilter': 'project = STAG AND issuetype = Epic'

But I believe this needs to be adjusted to look more like this:

"filters": {
        "issue-related-events-section": "STAG AND issuetype = Epic"}

Try this instead and let me know if this helps.  My apologies that the documentation appears to be lacking here, I will reach out to my team to see if we can clarify this.

Andy

Artiom Vasiliev August 25, 2021

Hey @Andy Heinzer and @Dario B, sadly this didn't work as I hoped for. Getting an error back that says the "filters" field is unrecognized:

{
"errorMessages":["Unrecognized field \"filters\" (Class com.atlassian.jira.rest.v2.webhook.DynamicWebhookRegistrationConfiguration), not marked as ignorable\n at [Source: org.apache.catalina.connector.CoyoteInputStream@51879649; line: 1, column: 262] (through reference chain: com.atlassian.jira.rest.v2.webhook.DynamicWebhookRegistrationConfiguration[\"filters\"])"]
}

Initially I thought this was related to the API v2 which I'm using, but switching to v3 or latest (e.g. /rest/api/latest/webhook) returned the same error.

Also looking at the open API schema (https://developer.atlassian.com/cloud/jira/platform/swagger-v3.v3.json), I can't find any "filters", it's in fact "jqlFilter":

Screenshot 2021-08-25 at 12.24.28.png

Artiom Vasiliev August 31, 2021

@Andy Heinzer, @Dario B I finally made it work, and the culprit is somewhat embarassing...

tldr: The endpoint for testing I was using (requestbin.net) didn't accept requests from Atlassian, and swithing it to another one solved everything!

I went all the way through signing up for a new account, trying old Rest API (i.e. /webhooks/1.0/webhook), re-creating system webhooks via UI. It was adding webhooks, but never hitting my endpoint. So out of desperation I decided to try another service for debugging HTTP requests, and wonderfully that one worked!

The reason I didn't rule out requestbin.net in the first place is that issuing requests from my terminal worked without any problems, I could see them getting accepted.

The documentation regarding "jqlFilter" is correct though :)

Thanks a lot for your help guys!

Like # people like this
Akash
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!
December 27, 2022

Hi @Artiom Vasiliev ,

Could you please elaborate on the Solution , since I too got stucked with the same issue.

Note:

I am getting triggers when the webhooks are configured directly in UI.

I have tried registering through REST API with the same Url  which I have used in UI but not receiving the triggers

Thanks!

Suggest an answer

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

Atlassian Community Events