Hello, I'm sending an alert to JSM/OpsGenie via PS Invoke-RestMethod in my Bitbucket pipeline. I'm trying to use variables in the JSON message. It works when I hard-code the value in the JSON message, the alert is updated in JSM. When I replace the value with a Bitbucket variable, it doesn't work. I do not get an error nor is JSM getting the alert. Does anyone have any ideas? I've tried using different combinations of double and single quotes as well as curly braces around the variable name but no luck. Thank you, Suzanne
Example: "id":"$env:TEAM_ID"
- Invoke-RestMethod -Method Post -ContentType 'application/json' -Uri "https://api.atlassian.com/jsm/ops/api/$env:CLOUD_ID/v1/alerts" -Headers $HEADER -Body '{ "message":"Deployment failed - Test", "responders":[ { "id":"$env:TEAM_ID", "type":"team" } ], "visibleTo":[ { "id":"$env:TEAM_ID", "type":"team" } ], "alias":"Test 123 alert", "description":"Deployment pipeline test", "priority":"P1" }'