Hi everyone,
I' trying to send a notification to a specific user using the rest api, I have been at this for a while now but cannot get the notification to the sed user, instead I'm getting the notification.
I have tried multiple combinations in the users section with no luck at all.
Can anyone tell me what I'm doing wrong here ?
def writer = new StringWriter()
def markupBuilder = new MarkupBuilder(writer)
// Note that markup builder will result in static type errors as it is dynamically typed.
// These can be safely ignored
markupBuilder.div {
p {
// update url below:
a(href: "https://example.atlassian.net/issue/${issue.key}", issue.key)
span(" has been created for this incident.")
}
p("Thank you")
p("Your Dev Team")
}
def htmlMessage = writer.toString()
def textMessage = new XmlSlurper().parseText(htmlMessage).text()
logger.info("Sending email notification to TopDesk for issue {}", issue.key)
def resp = post("/rest/api/2/issue/${issue.key}/notify")
.header("Content-Type", "application/json")
.body([
subject: "Incident: ${TOPDESKnumber}",
textBody: textMessage,
htmlBody: htmlMessage,
to: [
reporter: false,
assignee: false,
watchers: false,
voters: false,
users: [[
name: 'support2',
emailAddress: 'support@example.com',
active: true
]]
]
])
.asString()
logger.info(resp.toString())
assert resp.status == 204
Thank you
Philippe