I can successfully add a comment to an issue through the rest api, v3. I am now trying to include a @Mention to a new comment. I have tried @username, [~username], ~username, and [@username] to no avail. Is there anyway to include a mention on a comment though the rest api? I am currently using my own credentials to authenticate the api, I do have permission to create @Mentions.
Hi @Jim Gruszczynski ,
If I understand correctly you can successfully add a comment using the REST API v3 endpoint /rest/api/3/issue/{issueIdOrKey}/comment but you are unable to add user mentions in the body of the comment.
If my understanding is correct, then looking at the documentation for /rest/api/3/issue/{issueIdOrKey}/comment I can read:
body anything The comment text in Atlassian Document Format.
body
anything
The comment text in Atlassian Document Format.
If you open the Atlassian Document Format (ADF) page, on the left hand side menu, you can see a section named Node - mention that shows below example for adding a user mention in ADF:
@{ "type": "mention", "attrs": { "id": "ABCDE-ABCDE-ABCDE-ABCDE", "text": "@Bradley Ayers", "userType": "APP" } }
I am pasting below all the useful links for your reference. Please review them, try to add the user mention using ADF and let us know if this works as expected:
Cheers,Dario
Thank you very much @Dario B this helped and I now have @mentions added to the comments. Is there a way to get the email notifications to also be sent when the comment with a mention is added?
Thanks
Jim Gruszczynski
You are very welcome @Jim Gruszczynski ,
If the answer helped please remember to accept it so that the thread will be marked as answered.
Then, for the rest, can you kindly provide more details on what you mean with:
Is there a way to get the email notifications to also be sent when the comment with a mention is added?
The expected behavior is that users will receive notifications if they are mentioned in a comment. Please see below post for some more details:
Thank you for your quick reply. When in the JIRA Software web site, when a user adds a comment with a @mention to another user, the other user will receive and email that they were mentioned in a comment. Using the resources you pointed me at I was able to get the mention to work, but no emails were received by the mentioned users.
Thanks,
Jim
Alternate solution:
URI- https://<domain-name>/rest/api/3/issue/{issueKey}/comment
request body-
{
"body": "[~accountid:5d9d467e0d44fc0dca5413e7] <your comment>"
}
thaks @Abhishek Singh Negi
Solved my problem
I was looking for a solution for use with jira-python, and this did the trick. Thanks!
Hi
Might not be fully related - I am looking for something similar but not for REST API but to pre populate a JSM portal link:
Eg https://xxx.atlassian.net/helpcenter/it-service-management/portal/1031/group/1048/create/4372description=%5B~accountid%3A5cf51a2d22c5c3044e0ac3bd%5D+Please+provide+details+here&labels=testLabel&priority=1&summary=Assistance+needed
As you can see I added (in bold and urlencoded) a Jira user ID 5cf51a2d22c5c3044e0ac3bd - but it only shows the below:
I want it to prepopulate into an @ mention like this:
Please advise or guide me to another post that may help?
Thank you in advance
It looks like you're new here. Sign in or register to get started.