Configure webhook alerts
You can enable webhook alerts to send AVD deployment and deletion failure notifications to an HTTP endpoint such as Slack, Microsoft Teams, or a custom internal tool. They can run alongside existing email alerts or replace them, depending on the email-fallback setting.
Before you begin
Section titled “Before you begin”You need a webhook URL from your target system: a Slack incoming webhook, a Teams webhook via the Workflows app, or any HTTPS endpoint that accepts POST requests.
Configuration example
Section titled “Configuration example”-
Open the Secure Apps Console and navigate to Alerts → Configure Alerts. Switch to the Webhook tab.
-
Toggle Enable webhook alerts on.
-
Choose the HTTP Method. Slack and Teams webhooks expect
POST. -
Paste the webhook URL into the URL template field. The URL can contain template variables, which is useful if, for example, your endpoint expects the job dashboard link as a query parameter.
-
Add any Headers your endpoint requires. At minimum, set
Content-Type: application/json. Teams Workflows rejects requests without it. Slack accepts the request either way. Custom endpoints might need anAuthorizationheader. -
Fill in the Body template. Click Template variables to see the dynamic variables you can use. Below are examples for Slack and Teams:
{"text": "Exam {{.JobType}} issue: {{.ExamName}}","blocks": [{"type": "header","text": { "type": "plain_text", "text": "Exam {{.JobType}} issue" }},{"type": "section","text": {"type": "mrkdwn","text": "*{{.Environment}}* environment\n{{.ExamName}}\nDeadline: `{{.DeadlineTime}}`{{if .DeploymentDurationOverride}}\n_(reservation time overwritten)_{{end}}"}},{"type": "actions","elements": [{ "type": "button", "text": { "type": "plain_text", "text": "View job" }, "url": "{{.JobLogDashboardUrl}}" },{ "type": "button", "text": { "type": "plain_text", "text": "View exam" }, "url": "{{.ExamUrl}}" }]}]}{"type": "message","attachments": [{"contentType": "application/vnd.microsoft.card.adaptive","content": {"$schema": "http://adaptivecards.io/schemas/adaptive-card.json","type": "AdaptiveCard","version": "1.4","body": [{"type": "TextBlock","size": "Large","weight": "Bolder","text": "Exam {{.JobType}} issue"},{"type": "FactSet","facts": [{ "title": "Exam", "value": "{{.ExamName}}" },{ "title": "Environment", "value": "{{.Environment}}" },{ "title": "Deadline", "value": "{{.DeadlineTime}}" }]}],"actions": [{ "type": "Action.OpenUrl", "title": "View job", "url": "{{.JobLogDashboardUrl}}" },{ "type": "Action.OpenUrl", "title": "View exam", "url": "{{.ExamUrl}}" }]}}]} -
Set the Success status codes. Any response with a code in this list is treated as a successful delivery. Slack and Teams return
200, so the defaults (200,201,202,204) work out of the box. Adjust this only if your endpoint uses a non-standard success code. -
Select an Email fallback mode (see below).
-
Click Update to save.
Template variables
Section titled “Template variables”Use these placeholders anywhere in the URL or body template. They’re substituted per-alert with data from the deployment or deletion job.
| Variable | Example value | Description |
|---|---|---|
{{.JobType}} | deployment | Job type, either deployment or deletion. |
{{.ExamName}} | Biology midterm 2026 | Name of the exam the alert relates to. |
{{.ExamUrl}} | https://schoolyear.app/admin/exams/abc123 | Direct link to the exam in the Schoolyear Dashboard. |
{{.JobLogDashboardUrl}} | https://schoolyear.app/admin/jobs/xyz789 | Direct link to the job log (helpful for debugging). |
{{.DeadlineTime}} | 2026-04-22 09:24:28.602 +0000 UTC | Scheduled job deadline for the exam. |
{{.DeploymentDurationOverride}} | true / false | Whether the reservation time was overwritten. |
{{.Environment}} | prod | The environment the alert originated from. |
Test your webhook
Section titled “Test your webhook”Every webhook configuration page includes a Test webhook section so you can verify the endpoint before saving. No real exam has to fail for you to check the integration.
-
Fill in the test parameters: Job type, whether Reservation time overwritten applies, and a Deadline date/time. These are injected into your URL and body template alongside the hard-coded test values shown below the inputs.
-
Click Send. The request fires immediately against the URL you’ve typed into the form. The configuration does not need to be saved first.
-
Inspect the Request panel to see exactly what was sent (method, URL, headers, rendered body) and the Response panel to see the status code, headers, and body returned by your endpoint.
-
A green Success badge means the response code matched your configured success list. A red Failure badge means it didn’t. Check the Response panel for the real reason (usually a 4xx with an error message from Slack/Teams about the payload shape).
Email fallback modes
Section titled “Email fallback modes”The Email fallback setting controls what happens to the configured email alerts when a webhook is active.
- Only send email alerts when the webhook fails: email is sent only if the webhook delivery fails (non-success status code, timeout, or unreachable endpoint). Use this when the webhook channel is your primary alerting method.
- Send both webhook and email alerts: email is always sent alongside the webhook, regardless of webhook delivery status.
Troubleshooting
Section titled “Troubleshooting”Webhook returns 4xx or 5xx
Section titled “Webhook returns 4xx or 5xx”Open the Test webhook → Response panel to read the body. Slack and Teams always include a human-readable reason (e.g. invalid_blocks, Bad payload received by generic incoming webhook). Most often the JSON is valid but the shape doesn’t match what Slack/Teams expects.
Success badge green but nothing appears in the channel
Section titled “Success badge green but nothing appears in the channel”Check the webhook URL. If it points to an archived channel or a deleted connector, Slack/Teams can return 200 ok but silently drop the message. Recreate the webhook in the target system and paste the new URL.