Hello,
I have a Jira Automation Rule with a webhook. Inside of the webhook I send a POST call to create a Confluence page. The content of the page is populated with comments which come from Jira issues. This works when the comments in the Jira issues are single line. But if someone posted a comment on an issue that is multiline, the call breaks returning error code 400 and the following error message:
Illegal unquoted character ((CTRL-CHAR, code 13)): has to be escaped using backslash to be included in string value at [Source: REDACTED (`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION` disabled); line: 1, column: 1327]
The body of my POST call is as follows:
{"type":"page","title":"Weekrapportage. Week:{{now.weekOfYear}} Jaar: {{now.Year}}","space":{"key":"~myspace"},"ancestors":[{"id":404095077}],"body":{"storage":{"value":"
Deze weekrapportage laat alle comments op issues zien die de afgelopen week zijn gewijzigd! Als er géén wijzigingen in kaartjes zijn doorgebracht dan is deze pagina (nog) leeg!
{{#issues}}
key,summary,type,created,updated,due,assignee,reporter,priority,status,resolution{{key}}
{{#comments}}{{/}}
| Datum | Gebruiker | Commentaar |
|---|
| {{created.format("HH:mm:ss dd-MM-yyyy")}} | {{author.displayName}} | {{body}} |
{{/}}","representation":"storage"}}}
So right now the issue is happening at the {{body}} tag in the table under "Commentaar". After Googling the issue I found the issue (which is a newline breaking the call) and a possible solution by replacing the newline.
So I tried {{body.replace("\n"," ") and also this solution described here:
https://jira.atlassian.com/browse/JSWCLOUD-22517
But it doesn't work and the same error still occurs.
How do I handle multiline comments on jira issues without breaking the call to the Confluence REST API?