Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
badges earned

Your Points Tracker
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Notify rest with ScriptRunner for Jira cloud is not working


I'm trying to send an email to some user with ScriptRunner plugin.

This is my code:

import org.apache.commons.codec.binary.Base64;
import static

//Define authorisation credentails
String authString = "USER:PASS"
byte[] authEncBytes = Base64.encodeBase64(authString.getBytes());
String authStringEnc = new String(authEncBytes);

// Add this header into your rest call to specify basic authentication

def resp = post("/rest/api/2/issue/MSD-35/notify")
.header("Authorization", "Basic ${authStringEnc}")
.header("Content-Type", "application/json")
subject: 'Service desk automation success',
textBody: "Service desk ticket created with script runner automation.",
htmlBody: "test",
to: [
users: [[
name: "neta.elyakim",
active: true
assert resp.status == 204 

 The problem is it's not working- this is script runner docs on this

I just want to send the email.

I tried it with/out the authorization and it's still not working

This is the error:

Assertion failed: assert resp.status == 204 | | | | 400 false status: 400 - Bad Request body: <html> <head><title>400 Bad Request</title></head> <body bgcolor="white"> <center><h1>400 Bad Request</h1></center> </body> </html> at at Script1$ Source) at Script1$ Source) at at$evaluate$0.callCurrent(Unknown Source) at$evaluate$0.callCurrent(Unknown Source) at at Source)

Please advise!


1 answer

1 accepted

0 votes
Answer accepted

With the help of script runner support-

I manage to send the email to a different user:

def resp = post("/rest/api/2/issue/${issueKey}/notify")
.header("Content-Type", "application/json")
subject: 'Service desk automation success!',
textBody: "Service desk ticket created with script runner automation.",
htmlBody: "<p>Service desk ticket created with script runner automation.</p>",
to: [
//users: [[
/// name: "neta.elyakim",
// active: true
groups: [[
name: 'some group'

but when I tried to send the request with different user auth (not my auth - different user and to send it to myself)  it's didn't work.

In order to send the post request with someone else auth it needs to be done like this:

Bug with the notify rest:

Suggest an answer

Log in or Sign up to answer
Community showcase

All you wanted to know about customer support KPIs

When working in customer support, it’s crucial to calculate, analyze and monitor specific numbers, called KPIs (Key Performance Indicators). They go hand-in-hand with customer satisfaction, problem d...

5 views 0 1
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you