Is there a way to control the format of Webhooks in Alert Rules?

clester
Participant I

Using Apigee Edge, we have successfully created Alert Rules in Analytics->API Monitoring->Alert Rules that send alerts to Slack, merely by selecting "Slack" as the channel and setting the correct Slack URL for the Destination.

We would like to send alerts to Teams, using a webhook, but even though we have selected "Webhook" as the channel and put the correct URL in the "Destination" (195 characters, BTW, and I read that 200 is the max), and we have the notification going to both Slack and Teams for each such event, we only see notification in Slack, and never in Teams. I suspect Teams is ignoring the message because it's not properly formatted by Apigee (we have non-Apigee alerts going successfully to Teams).

What is the format of the message issued by an Apigee webhook Alert?

Is there a way to control it?

Solved Solved
0 2 526
1 ACCEPTED SOLUTION

The webhook object is defined here: https://docs.apigee.com/api-monitoring/alerts-notifications#webhook-object

You can create an API proxy as the destination for the webhook and reformat as needed for your specific target. Here's a sample message that I captured in Trace.


{
	"alertInstanceId": "05985927-ab93-4933-9d62-51744d64af0e",
	"alertName": "404 Not Found Test Webhook Test",
	"org": "amer-demo13",
	"description": "404 Not Found Test with Webhook",
	"alertId": "6f8ff505-16db-11ea-ad50-42010a850821",
	"alertTime": "2020-10-05T16:04:11Z",
	"thresholdViolations": {
		"0 - Count": "Duration=5 minutes Proxy=ALL Region=us-east1 Status Code=404 Trigger Value=7 Violation=sustained above 5.0"
	},
	"thresholdViolationsFormatted": [{
		"metric": "count",
		"proxy": "ALL",
		"region": "us-east1",
		"statusCode": "404",
		"comparisonType": "above",
		"thresholdValue": "5.0",
		"triggerValue": "7",
		"duration": "5 minutes",
		"violation": "sustained above 5.0"
	}],
	"playbook": "Check out the 404 playbook for test"
}

View solution in original post

2 REPLIES 2

The webhook object is defined here: https://docs.apigee.com/api-monitoring/alerts-notifications#webhook-object

You can create an API proxy as the destination for the webhook and reformat as needed for your specific target. Here's a sample message that I captured in Trace.


{
	"alertInstanceId": "05985927-ab93-4933-9d62-51744d64af0e",
	"alertName": "404 Not Found Test Webhook Test",
	"org": "amer-demo13",
	"description": "404 Not Found Test with Webhook",
	"alertId": "6f8ff505-16db-11ea-ad50-42010a850821",
	"alertTime": "2020-10-05T16:04:11Z",
	"thresholdViolations": {
		"0 - Count": "Duration=5 minutes Proxy=ALL Region=us-east1 Status Code=404 Trigger Value=7 Violation=sustained above 5.0"
	},
	"thresholdViolationsFormatted": [{
		"metric": "count",
		"proxy": "ALL",
		"region": "us-east1",
		"statusCode": "404",
		"comparisonType": "above",
		"thresholdValue": "5.0",
		"triggerValue": "7",
		"duration": "5 minutes",
		"violation": "sustained above 5.0"
	}],
	"playbook": "Check out the 404 playbook for test"
}

Thank you!