How can I escape special characters when sending issues comment through a webhook?

Pablo Serra February 11, 2022

Hi There,

I have a rule that comments issues on a cloud instance with the last comment body of the issues of another cloud instance, by sending {{issue.comments.last.body}} through a webhook:

Comment Body 1.png


I'm having some issues with special characters, e.g.:

Comment Body 2.png

Comment Body 3.png

On the receiving instance I'm getting the following:

Comment Body 4.png

Any suggestion on how to handle this kind of comments?

Thanks in advance!

3 answers

1 accepted

3 votes
Answer accepted
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 5, 2022

Hi @Pablo Serra 

Have you tried any of the smart value encoding functions provided by automation before sending the message: 

Kind regards,

Pablo Serra March 9, 2022

Hi Bill, thanks for your reply.

I've contacted support and after a little back and forth, they provided me the following function that did the trick: asJsonString()

In my post:

"commentAuthor": "{{ }}",
"commentBody": {{ issue.comments.last.body.asJsonString() }},
"keyBancar":"{{ issue.key }}",
"summary":"{{ issue.fields.summary }}",
"keyIssues":"{{ issue.fields.customfield_10716 }}"

Please note that it must be sent without the quotation marks around the curly brackets.

More info about this function:

Like # people like this
Laura Bachiller January 26, 2024


You can also use the json encode function:


0 votes
Graeme Baker September 30, 2023

This is really old, but I've been trying to do the same thing lately and came across this article.

All I want to do is comment on an issue in 1 instance, and have that fire off a message to a webhook in Jira automation, and it add that comment to a linked ticket (via custom field).

From above there was a missing colon, and comma:

"comment": {
"id" : "{{}}",
"body" : {{comment.body.asJsonString()}},
"author" : {
"accountId" : "{{}}",
"displayName": "{{}}"



How do I use an incoming webhook to update a specific issue with this comment from the payload using these smart values?

0 votes
Pablo Serra February 11, 2022

Apparently the problem are the line breaks. Only comments with line breaks failed to impact on the receiving instance.

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events