Webhook Test Connection
The Webhook Test Connection API allows super users to validate a Slack webhook URL before saving it as a Webhook resource.
NOTE: This API requires the following feature flag to be enabled: Webhooks.
Test a Webhook Connection
Send a test message to a Slack webhook URL to verify connectivity, without creating or updating a Webhook resource.
NOTE: This endpoint requires the following feature flag to be enabled: Webhooks.
POST /api/v2/webhooks/test/
| Fields | Required | Description |
|---|---|---|
| url | Yes | The Slack webhook URL to test. Must use https and match hooks.slack.com/services/... or hooks.slack-gov.com/services/.... |
POST /api/v2/webhooks/test/ HTTP/1.1
Accept: application/json
Authorization: Token "YOUR SDE ACCESS TOKEN"
{
"url": "https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX"
}
On success, the API returns HTTP 200 with a confirmation message:
HTTP/1.1 200 OK
Content-Type: application/json
{
"success": true,
"message": "Webhook connection test succeeded."
}
When the URL is valid but Slack (or the network probe) reports a failure, the API still returns HTTP 200 with success set to false and an error string describing the problem (for example an invalid or archived webhook):
HTTP/1.1 200 OK
Content-Type: application/json
{
"success": false,
"error": "Webhook URL no longer valid"
}
When the url fails validation (format, allowed hosts, or similar), the API returns HTTP 400 with field errors, for example:
HTTP/1.1 400 BAD REQUEST
Content-Type: application/json
{
"url": [
"Enter a valid URL."
]
}