Bhavya-org / Scripts

0 stars 0 forks source link

New Request Creation Notifications #29

Open sani-d opened 3 weeks ago

sani-d commented 3 weeks ago

def issueKey = issue.key

// Notification part with request type condition def requestBody = [ subject: "New Training Request - ${issue.fields.summary}", htmlBody: """${issue.key} ${issue.fields.description} "https://tideaccount.atlassian.net/${issue.key}" """, to: [ groups: [ [name:"MOps - Training"], [name:"ms_qa"] ] ] ]

def resp = post("/rest/api/3/issue/${issueKey}/notify") .header("Content-Type", "application/json") .body(requestBody) .asString()

// Handle notification response if (resp.status == 200 || resp.status == 204) { println "Notification sent successfully." } else { println "Failed to send notification. Status code: ${resp.status}, Response body: ${resp.body}" }