Send email to a project role

Platform Notice: Cloud - This article applies to Atlassian products on the cloud platform.

Summary

Sometimes we need to send emails to specific project role users, however, the send email action in the automation can send emails to user picker fields and groups only. In this article, we show how to create an automation to get the users’ email addresses within a role, and with that, be able to send emails to them.

This feature request is opened to have this implemented:

Requirements

  • Identify the role you would like to send the email to:

    1. Access the following URL to get the list of the roles you have within the project, as we will use the role id in order to achieve it:


      1. https://<yourinstance>.atlassian.net/rest/api/3/project/{projectid}/role/

         

    2. You should see the list of roles available for your project, you should be able to identify the role id in the URLs listed, right after …/role/{roleid}.

Solution

  1. Trigger: Issue Created (You can select the trigger based on your case scenario)

  2. Action: Send a web request to the following endpoint:

    1. https://<yourinstance>.atlassian.net/rest/api/3/project/{projectid}/role/{roleid}
  3. With that, we should receive a payload with everyone in the Service Desk Team role

  4. Branch Using an advanced branch, we should be able to execute the following actions for each of the results and add it to a variable, in this example {{newusers}}

  5. Action: Send a new web request to get the list of users' email addresses: 

    https://<yourinstance>.atlassian.net/rest/api/3/user/search?accountId={{newusers}}
  6. Action: Send email to {{webResponse.body.emailAddress}}, which contains all the users' email addresses

Your role should look like this:

With that, we should be able to send individual emails to all of the members of the specified role.


IMPORTANT NOTE: Keep in mind that for this workaround to work as I mentioned, the users who should receive the email (Service Desk Team), must have their email address visible, under their account settings, as per the following document:

Last modified on Jan 27, 2025

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.