Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to identify which Issue is updated from Attachment?

I have an integration setup between Servicenow and JIRA using webhook. So when an attachment is added to the Issue is JIRA, two webhook events are triggered: “attachment_created” and “comment_created”.
However if we check the “attachment_created” JSON body which is sent over to Servicenow, we are not able to identify which issue in Jira was updated. Here is the JSON body which is sent over to Servicenow:

{"timestamp":1639107865465,"webhookEvent":"attachment_created","attachment":{"self":"","id":"28271","filename":"Test document (87b03c0b-5773-4627-841d-86f919aca5e7).txt","author":{"self":"","accountId":"60f18969a2243e0070571395","avatarUrls":{"48x48":"","24x24":"","16x16":"","32x32":""},"displayName":"Aniket Bhanse","active":true,"timeZone":"America/New_York","accountType":"atlassian"},"created":"2021-12-09T22:44:25.465-0500","size":42,"mimeType":"text/plain","content":""}}

Can we update the JSON body so that it sends over the issue number/issue ID as well? Or how will we identify which issue was updated in JIRA? Any suggestions?


1 answer

0 votes
Andy Heinzer Atlassian Team Dec 17, 2021

Hi Aniket,

I can see that it appears someone else from your site created a support case for this same issue.  Below is a response from my colleague, Russ, that I hope that this response will help other users that might come across this problem as well:

The attachment created event webhook payload does not currently contain the issue key where the attachment was created. Including the issue key in the attachment created webhook payload has been requested in the past, however that request was closed due to lack of interest.

There are a couple ways you can surface the issue key in a webhook and associate it with an attachment. As mentioned on the feature request above, you can use {issue.key} or {} query parameter value in the webhook URL as described in

Alternatively, you can use the issue updated event rather than the attachment created event in the webhook configuration. This will produce a webhook JSON payload containing the full details of the issue at the time of the update which will include the issue key as well as additional details of all the fields associated with the issue, including attachments. It will also include a changelog entry as below which contains the details of the added attachment.

  "changelog": {
    "id": "15995",
    "items": [
        "field": "Attachment",
        "fieldtype": "jira",
        "fieldId": "attachment",
        "from": null,
        "fromString": null,
        "to": "10036",
        "toString": "Sample.pdf"

Note that this approach will likely require custom parsing of the webhook content on the ServiceNow side in order to pull out the issue key, attachment ID, and attachment content URL.

I also ran across this ServiceNow community post that may provide some additional guidance on how to copy attachments between Jira and ServiceNow.

I hope this helps.


Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Jira Software

👋 Looking for 15-20 volunteers to test Atlassian training content

Hi everyone! Are you interested in beta testing Atlassian University’s newest (unreleased!) training course? We’re looking for 15-20 volunteers to test our newest training course, Basic reporting...

595 views 21 25
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you