Create
cancel
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

Retrieving Comment body and Comment Author from webhook data

Hello,

I'm trying to configure a set of automation rules to keep synchronized issues between 2 cloud instances. 

One of my goals is to retrieve a comment body and a comment author from a webhook payload. I've tried {{webhookData.comment.body}} and {{webhookData.comment.author.displayName}} without any luck.

At the moment I'm only trying to log the data on the receiving instance's rule:

Aut1.pngAut2.png

Any help on these will be much appreciated.

Thanks!

1 answer

1 vote
Dario B Atlassian Team Jul 09, 2021

Hello @Pablo Serra ,

Not knowing how you have configured the "source" rule (the one triggered on issue commented event) I cannot say much on why you get an empty body.

However, I have tried to do something similar on my end, and I can actually get the right values in the request body by doing the following:

Automation-Rule-On-Issue-Commented.jpg

 

By configuring the source rule as above, I get the below payload when adding a comment to an issue in the specific project:

{
  comment: {
    "id" : "10533"
    "body" : "TEST COMMENT - SOME RANDOM TEXT"
    "author" {
      "accountId" : "557XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX24c"
      "displayName": "Dario B"
    }

  }

}

 

You will then be able to access the different valued from the above body by using:

  •  {{webhookData.comment.id}} 
  • {{webhookData.comment.body}}
  • {{webhookData.comment.author.displayName}}
  • {{webhookData.comment.author.accountId}}

 

You can off course further customize the body to be sent in order to include other properties like the issue key or id and any other information you desire to receive.

 

Please test this and let me know if it helps.

 

 

Cheers,
Dario

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Site Admin
TAGS
Community showcase
Published in Trello

🏊‍♀️ Atlympic Event: Trello

Hello Community!  Quick disclaimer: We are running a contest on Community (The Atlympics!) from July 23rd - August 8th of 2021. If you are interested in participating in this contest (prizes! ...

91 views 1 10
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