Node.js
import { MailChannels } from "mailchannels-sdk";
const { MAILCHANNELS_API_KEY } = process.env;
if (!MAILCHANNELS_API_KEY) throw new Error("Set MAILCHANNELS_API_KEY before running");
const mailchannels = new MailChannels(MAILCHANNELS_API_KEY);
const { data, error } = await mailchannels.webhooks.validate();
if (error) {
console.error("Validate webhook failed:", error);
process.exit(1);
}
console.log(data);import os
import sys
import mailchannels
if not os.environ.get("MAILCHANNELS_API_KEY"):
sys.exit("Set MAILCHANNELS_API_KEY before running")
# Send a test event to each enrolled webhook and report whether it responded
# with a 2xx status. request_id is optional; if omitted, one is generated.
response = mailchannels.Webhooks.validate(request_id="test_request_1")
print(response)<?php
require_once __DIR__ . '/vendor/autoload.php';
use MailChannels\Client;
$api_key = getenv('MAILCHANNELS_API_KEY') or exit("Error: MAILCHANNELS_API_KEY is not set\n");
$client = new Client(apiKey: $api_key);
// Send a test event to each enrolled webhook and report whether it responded
// with a 2xx status. request_id is optional; if omitted, one is generated.
$response = $client->webhooks->validate(requestId: 'test_request_1');
print_r($response->toArray());curl --request POST \
--url https://api.mailchannels.net/tx/v1/webhook/validate \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <x-api-key>' \
--data '
{
"request_id": "<string>"
}
'{
"all_passed": true,
"results": [
{
"response": {
"status": 200,
"body": "<string>"
},
"result": "passed",
"webhook": "<string>"
}
]
}{
"errors": [
"<string>"
]
}Validate Enrolled Webhook
Validates whether your enrolled webhook(s) respond with an HTTP 2xx status code. Sends a test request to each webhook containing your customer handle, a hardcoded event type(test), a hardcoded sender email(test@mailchannels.com),a timestamp, a request ID (provided or generated), and an SMTP ID. The response includes the HTTP status code and body returned by each webhook.
POST
/
webhook
/
validate
Node.js
import { MailChannels } from "mailchannels-sdk";
const { MAILCHANNELS_API_KEY } = process.env;
if (!MAILCHANNELS_API_KEY) throw new Error("Set MAILCHANNELS_API_KEY before running");
const mailchannels = new MailChannels(MAILCHANNELS_API_KEY);
const { data, error } = await mailchannels.webhooks.validate();
if (error) {
console.error("Validate webhook failed:", error);
process.exit(1);
}
console.log(data);import os
import sys
import mailchannels
if not os.environ.get("MAILCHANNELS_API_KEY"):
sys.exit("Set MAILCHANNELS_API_KEY before running")
# Send a test event to each enrolled webhook and report whether it responded
# with a 2xx status. request_id is optional; if omitted, one is generated.
response = mailchannels.Webhooks.validate(request_id="test_request_1")
print(response)<?php
require_once __DIR__ . '/vendor/autoload.php';
use MailChannels\Client;
$api_key = getenv('MAILCHANNELS_API_KEY') or exit("Error: MAILCHANNELS_API_KEY is not set\n");
$client = new Client(apiKey: $api_key);
// Send a test event to each enrolled webhook and report whether it responded
// with a 2xx status. request_id is optional; if omitted, one is generated.
$response = $client->webhooks->validate(requestId: 'test_request_1');
print_r($response->toArray());curl --request POST \
--url https://api.mailchannels.net/tx/v1/webhook/validate \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <x-api-key>' \
--data '
{
"request_id": "<string>"
}
'{
"all_passed": true,
"results": [
{
"response": {
"status": 200,
"body": "<string>"
},
"result": "passed",
"webhook": "<string>"
}
]
}{
"errors": [
"<string>"
]
}Headers
Body
application/json
Optional identifier in the webhook payload. If not provided, a value will be automatically generated.
Maximum string length:
28Was this page helpful?

