Automatically Add Watchers to Issues on Creation
Platform Notice: Cloud - This article applies to Atlassian products on the cloud platform.
Summary
One requirement users/admins will have while working on issues in real-time in Jira projects is to add themselves as watchers to the tickets so that they can stay updated. Sometimes, it can be cumbersome for admins to add the same set of users to the tickets as watchers every time. To avoid this, we can have an automated action in Jira to achieve the same if the list of users is known beforehand.
The solution explained aims to teach how to add a set of users as watchers to tickets automatically.
Steps
To achieve this, use Automation for Jira to create an automation rule, as described in the next few steps. Alternatively, you can use Jira's native REST API.
Steps to create an Automation Rule to add Watchers:
- Navigate to System → Global Automation → Create Rule option to create a new automation rule.
- Trigger: Issue created.
- Action: Manage watchers.
- In the Add these watchers section, select all the users who would be automatically added as watchers to the issues
Please note that you can only add users, adding groups is not allowed.
- In the Add these watchers section, select all the users who would be automatically added as watchers to the issues
- Save the details and turn on the rule.
- A sample screenshot of the rule created for local testing is attached for reference.
- Now try creating a new issue and validate the behaviour, you should be able to see the list of users provided in the automation rules as part of the watcher's list.
Alternate Solution using Jira API
- There is a REST API call for adding watchers to the issue, here is the reference: POST Add watcher.
curl --request POST \ --url 'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}/watchers' \ --user 'email@example.com:<api_token>' \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --data '"<string>"'
Conclusion
Through this exercise, we believe you should be able to automatically add watchers to Jira Issues when they are created. Please note that this is at user level (not group level), you need to add the list of users to the automation rule.