Hi everyone,
I have two projects A and B. When a new comment is created in A, I want that new comment to show up in a specific issue in project B. For that, I have already set up a rule with the trigger "Issue Commented" and following the action "Web Request" where I just want to send that new comment to project B.
And I just don't know how to formulate the custom data for the POST. Currently I have:
{
"body": "{{triggerIssue.comment.body}}"
}
but I only get the error message: {"errorMessages":[],"errors":{"comment":"Comment body is not valid!"}}
I also tried multiple other versions that also don't work.. So, I need some help here.. Does anybody know how to do it properly?
Thanks in advance!
Best,
Hey @Alexander Tesch , welcome to the Atlassian Community. The request body format depends on the version of the API you use. For v3 you will have to send the comment in Atlassian Document Format. The documentation for adding a comment using v3 can be found here.
When using v2 of the Jira API, you will have to post the body as text, the same way as in the above request. The documentation for adding a comment using v2 can be found here.
Let me know if that helps!
Thanks for your replies!
Right, that's what I was also trying, but I don't seem to get it right in the custom data of my POST web request (v3):
{
"body": {
{{triggerIssue.comment.body}}
}
}
What am I missing?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You want to use the example below for v3:
"body": {
"content": [
{
"content": [
{
"text": "{{triggerIssue.comment.body}}",
"type": "text"
}
],
"type": "paragraph"
}
],
"type": "doc",
"version": 1
}
V2 is much easier as you can post the body as text
{
"body": "{{triggerIssue.comment.body}}"
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
with the additional curly brackets { } encompassing the whole body object, it works now. Awesome! Thank you so much Marios! :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, @Alexander Tesch
One question - is there a reason to use such workaround with webhooks?
If target issue is issue in the same instance, you can look for it with Automation action, and change it's description through Automation.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, these two projects are in separate instances, so we need web requests as far as I know.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Got it. Please, take a look here, just yesterday solved very similar problem.
Here is official manual, how request must look like:
https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-comments/#api-rest-api-3-issue-issueidorkey-comment-post
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks all for info. I'm new in this thread with similar problem, anybody can point me in what place we create body for POST, in my case I'm using ISSUE DATA (Automation format) in drop down ? where I need to go to check all those fields ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.