Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Automatically send all the issue public comments by email

This workaround aims to assist Jira Service Management (JSM) projects (can also work for JSW and JWM products), which involves utilizing the Automation for Jira (A4J) feature to share all public (customer-visible) comments made in a issue via email.

 

This design is particularly useful in scenarios where you want to generate reports, notifications, or emails that include only the comments visible to customers, thereby maintaining the privacy of internal discussions and ensuring that only relevant, public-facing information is shared outside of the internal team. 

At the moment, there are certain limitations in how to achieved this feature, but it is possible to workaround it using HTLM with Handlebars syntax.

Workaround steps:


Handlebars syntax is very particular about how conditionals and blocks are opened and closed. So in order to only get the public comments we can use the conditional check syntax below:

{{^internal}}

 

By using the {{^internal}} conditional check, the template ensures that only public (customer-visible) comments are included in the output. Internal comments are skipped and not processed within the {{^internal}}...{{/internal}} block.

Therefore, the HTML code to send the comments in the normal order will be:

{{#issue.comments}}
{{^internal}}
From: {{author.displayName}}
Sent: {{created}}
{{body}}
<hr>
{{/internal}}
{{/issue.comments}}

 

To order the comments by the most recent, you'll need to add ".reverse" as shown below:

{{#issue.comments.reverse}}
{{^internal}}
From: {{author.displayName}}
Sent: {{created}}
{{body}}
<hr>
{{/internal}}
{{/issue.comments.reverse}}

 Extra tip

To include an emoji in the email title or body sent from Jira automation, you should use the Unicode equivalent of the emoji instead of the colon-syntax (:emoji:) that is commonly used in markdown or platforms like Slack.

The emoji for a speech bubble doesn't have a direct, universally recognized shortcode across all platforms, but you can use the Unicode character for it.

However, when inserting this into an email subject or any text content, you must use the actual emoji character, like 🗨️, instead of the Unicode string. Most modern email clients and web interfaces support emojis, but how you insert them will depend on the system you're using for the automation.

Here are some steps and tips on how to achieve this:

  1. Direct Insertion:

    • If you're editing the automation rule or the email subject line directly in a web interface, you might be able to insert the emoji directly. On Windows, you can use the emoji keyboard by pressing "Win + ." (the Windows key and the period key at the same time) to bring up the emoji selection panel. On a Mac, you can use "Ctrl + Cmd + Space" to bring up the emoji picker.

    • Simply find the speech bubble emoji, 🗨️, and click or tap it to insert it into your text.

  2. Copy and Paste:

    • If for some reason you're unable to use the emoji picker or if the interface where you're setting up the automation doesn't support it, you could go to a website that lists emojis, find the speech bubble emoji, and copy it. Then, paste it directly into your email title in the Jira automation configuration. A simple web search for "speech bubble emoji" should lead you to a site where you can copy it.

  3. HTML Entities (If Applicable):

    • In some cases, you might be able to use HTML entities to include emojis or special characters. This would be more common in the body of an email rather than the subject. For the speech bubble emoji, if supported, you could use &#x1F4AC;. Note, however, that this method is less likely to be supported in email subjects.

 This workaround will work as I demonstrate in the screen recording below:

5 comments

Rick Westbrock
Contributor
June 10, 2024

Thank you so much for sharing this, just a couple of weeks ago I fielded a user request to send an e-mail with only customer facing comments and just couldn't figure out how to do that so this solved the problem for me.

Like Bruno Altenhofen likes this
Bruno Altenhofen
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 4, 2024

Thanks for the feedback, @Rick Westbrock :D

Jeff Pittman
Contributor
August 15, 2024

I want the trigger to be Comment is made.  Condition is to be that Comment is Public, and for the Action to be the last public comment from Automation for Jira in an eMail w. some other attributes from the ticket.

I know there is a "Public Comment Added" notification to all Cusotmers Involved, but Participants have to "opt in", otherwise they won't receive ANY notifications.  

So this is an override, of sorts to get a notification to the participants whether they opted in or not if any public comment is made.

Gabe Cz October 31, 2024

awesome thank you for this.

one quickie here is there a way to not include the currently added comment in this? because that's what i'm starting the email notification with and i'd like to put all the previous comments to the bottom of the email and it seems impractical to include the fresh comment 2x. i tried {{^last}} {{/last}} as a pathetic guess since ^internal does what it looks like it does. very talkatively.

is there a reference website for all the {{things}} with all the ^, #, and other "switches"?

i'm just learning this so please go easy on me

thanks

Anthony November 10, 2024

This is brilliant. Thank you.

May I ask where the doco is for the below syntax?

{{#issue.comments.reverse}}
{{^internal}}

All I could find was a section on "{{issue.comments}}" under https://support.atlassian.com/cloud-automation/docs/jira-smart-values-issues/

I've adapted it with the help of Jira Support to the below:

 

{{#issue.comments.reverse}}

{{^internal}}

From: {{author.displayName}} @ {{created.toDateTimeAtCurrentTime("Australia/Sydney").shortTime}}

{{body.text}}

---

{{/internal}}

{{/issue.comments.reverse}}

Comment

Log in or Sign up to comment
AUG Leaders

Atlassian Community Events