When using the Send notification for issue API, text is not sent in HTML. When only “htmlBody” is defined in the body (without “textBody”), the email is left blank. If both are defined, only “textBody” is sent (without html). The test was performed using the sample text from the documentation itself:
“htmlBody”: “The latest test results for this ticket are now available.”
Example of blank email without anything defined in htmlBody:
Could you perhaps share a version of the entire request you are making? I send notifications regularly with htmlBody and the body goes through. But the email that gets sent looks different to the one you shared (it starts with “[App User] has a message for you about a work item”).
The notification body is something like the following:
const notificationBody = `{
"htmlBody": "<p>text</p>",
"subject": "Content to verify",
"textBody": "text",
"to": {
"assignee": false,
"groupIds": [],
"groups": [],
"reporter": false,
"users": [
{
"accountId": "${idToNotify}"
}
],
"voters": false,
"watchers": false
}
}`;
And the request is like this:
await api
.asApp()
.requestJira(
route`rest/api/3/issue/${JIRA_ISSUE_KEY}/notify`,
{
method: "POST",
headers: {
Accept: "application/json",
"Content-Type": "application/json",
},
body: notificationBodyData,
}
)
Hello, thank you for your response. Using the same suggested structure produces the same behavior. In the first example, the evidence of the structure sent by Postman and its response, in addition to the email sent by Atlassian with this request. In this case, the content does not appear with the indicated HTML (the text “latest” is expected to be in bold), so I assume that the content of “textBody” is being sent and not “htmlBody.”
In the second example, I show how when sending only the “htmlBody” in the structure, the email arrives blank.
Example 1
Example 2
Hello @AaronCollier
I’ll second what @AaronCollier has said. I use the Send notification for Issue endpoint to send HTML formatted messages all the time, and they arrive with their HTML formatting intact and showing correctly:
Regarding the email app you’re using (the thing you’ve shown a small screen grab of)… I don’t know of any that will show both the HTML and the text version of an email at the same time, they usually show one or the other. Have you considered that your email app is configured to only show text messages, not HTML, so when you send a HTML only message, there is nothing for that app to display?
Next, are you aware that Jira Cloud / JSM Cloud can be configured by the administrators to default user accounts to only sending emails as text and to not send HTML emails? Have you asked your instance admins if they have made that configuration change?
Lastly, are you aware the you can change your account preferences to only send emails in text and not HTML? Have you checked your own Atlassian account settings?
Hello, thank you for your reply. The problem was the configuration of the Atlassian instance. The “Default outgoing mail format” setting was changed to HTML, and now the email arrives with the format specified in htmlBody.
2 Likes