I'd like to send notifications using the following in the Users section:
I don't see any way to do these things. Is there a way?
Hello @Rich Scire
Are you referring to the /rest/api/3/issue/{issueIdOrKey}/notify endpoint?
If so, can you provide the content of the POST request you're making to that endpoint, and the method / tool you're using to submit that request.
It's embedded in a Scriptrunner listener. Here is the code:def resp = post("/rest/api/2/issue/${issueKey}/notify").header("Content-Type", "application/json").body([subject : subject,textBody: body,htmlBody: "<p>${htmlBody}</p>",to : [users: [[accountId : b2b_ops]]]]).asString()
I know I can include the assignee, reporter, groups and users. Can I add an email address or a text field that contains and email address?
Thanks for your help.
When you drill down through the documentation for that REST API endpoint as to what the NotificationRecipients can contain, it says that is can contain a value users which can be an array of UserDetails which is the type:
accountId stringThe account ID of the user, which uniquely identifies the user across all Atlassian products. For example, 5b10ac8d82e05b22cc7d4ef5.Max length: 128
accountId
string
The account ID of the user, which uniquely identifies the user across all Atlassian products. For example, 5b10ac8d82e05b22cc7d4ef5.
Max length: 128
128
So, in short, the only things that can be used as the recipient of the to part of the request for users are accountIDs, nothing else.
If you want to notify users other than the assignee, reporter, group etc, you're going to need to do a lookup of those users' accountIDs first, based on their email addresses, by using the find users endpoint , like this:
/rest/api/3/user/search?query=whatever@whatever
Once you know all their accountIDs, then you can put that information into the ScriptRunner request's body.
To me, it sounds like you'd be better of using a group to contain all the users you want to notify, because a group can be a recipient. The next level of complexity up from that is to consider a custom notification scheme, but that is really using a sledge hammer on a brad.
It looks like you're new here. Sign in or register to get started.