We have a use case where comments are created on Jira issues through the api, in the format `[~user.email@address.com]`. In the old Jira view the email would display normally, in the new view the tag renders as a "User" pill, that links to an unknown user.
How can we allow the user's email to be rendered in the comment?
Hello @Maxx Lehmann,
Welcome to Atlassian Community!
Testing on my local site, adding a comment via API using the endpoint below, it added a comment and it shows the user email address. I added it using the same format you mentioned here.
curl --request POST \
--url
'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}/comment' \
--user 'email@example.com:<api_token>' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"body": {
"type": "doc",
"version": 1,
"content": [
{
"type": "paragraph",
"content": [
{
"text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque eget venenatis elit. Duis eu justo eget augue iaculis fermentum. Sed semper quam laoreet nisi egestas at posuere augue semper.`[~user.email@address.com]`",
"type": "text"
}
]
}
]
}
}'
In case you want to mention a user, please, check the thread below that has more details about it:
If that's not what you needed, please, let us know more details about the issue, and feel free to share screenshots (just make sure to hide private information).
Regards,
Angélica
Hi Angelica,
We are currently using the V2 API.
In the new view, this is what is shown:
And this is what we had in the old view:
I think I understand more clearly now, that the `User` pill is displaying because the tagged user is not found, as it uses whatever is the [~xxx] as an `accountId`.
Is there any way to show the email like in the old view?
Alternatively, is there any chance a `commentOnBehalfOf` would be implemented any time soon? That would easily fix this use case.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for the details, Maxx.
The old view uses Wiki Markup and the new one Markdown, that's why the syntax you are using is not working as expected, so any email that you add using the format `[~user.email@address.com]` will end up showing as "@user".
In this case, since currently there is no endpoint to comment on behalf of an user, you can use the API v3 to mention the author. It will show their full name when mentioning and if you want to show their email address, then you need to add it as a text and it will show on the comment as a normal text (not a link).
curl -v --request POST \
--url 'https://domain.atlassian.net/rest/api/3/issue/ISSUEKEY-123/comment' \
--user 'user@domain.com:TOKEN' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"body": {
"type": "doc",
"version": 1,
"content": [
{
"type": "paragraph",
"content": [
{
"text": "Author: user@domain.com\n\n",
"type": "text"
},
{
"type": "mention",
"attrs": {
"id": "1a23b45c6789101d2e345678",
"text": "user@domain.com",
"userType": "APP"
}
}
]
}
]
}
}'
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.