POST /v1/organization/test-discord-webhook
Test your Discord webhook configuration by sending a preview message with sample data. This endpoint automatically resolves all template variables with realistic sample values and sends a test message to your Discord channel, allowing you to verify that your webhook URL is correct, your message templates render properly, and your embed formatting looks good before enabling notifications in production. The test message includes a special indicator to distinguish it from real vote notifications. Use this endpoint during setup to preview how your messages will appear, when updating message templates to verify changes, or to troubleshoot webhook connectivity issues.
Request
http
POST https://api.votepipe.com/v1/organization/test-discord-webhook
Authorization: Bearer mr_live_your_api_key_here
Content-Type: application/json
{
"webhook_url": "https://discord.com/api/webhooks/123456789/abcdefghijk",
"message_type": "embed",
"message_template": "๐ **{{voter_name}}** voted on **{{provider_name}}**!",
"embed_template": {
"color": 65280,
"title": "๐ New Vote Received!",
"description": "**{{voter_name}}** just voted on **{{provider_name}}**",
"fields": [
{"name": "Vote ID", "value": "{{vote_id}}", "inline": true}
],
"footer": {"text": "VotePipe โข Vote Notification"},
"timestamp": "{{received_at}}"
}
}Request Body
| Field | Type | Required | Description |
|---|---|---|---|
| webhook_url | string | Yes | Discord webhook URL to test |
| message_type | string | No | Message type: "simple" or "embed" (default: "simple") |
| message_template | string | No | Message template for simple messages (required if message_type is "simple") |
| embed_template | object | No | Embed JSON template for embed messages (required if message_type is "embed") |
Response (200 OK)
json
{
"data": {
"success": true,
"message": "Test embed sent successfully! Check your Discord channel."
}
}Response (400 Bad Request)
json
{
"error": {
"code": "WEBHOOK_ERROR",
"message": "Failed to send test webhook",
"details": {
"error": "Status 404: Unknown webhook"
}
}
}Example: cURL
bash
curl -X POST https://api.votepipe.com/v1/organization/test-discord-webhook \
-H "Authorization: Bearer mr_live_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"webhook_url": "https://discord.com/api/webhooks/123456789/abcdefghijk",
"message_type": "embed",
"embed_template": {
"color": 65280,
"title": "๐ New Vote Received!",
"description": "**{{voter_name}}** just voted on **{{provider_name}}**",
"fields": [{"name": "Vote ID", "value": "{{vote_id}}", "inline": true}],
"footer": {"text": "VotePipe โข Vote Notification"},
"timestamp": "{{received_at}}"
}
}'Example: JavaScript
javascript
const response = await fetch('https://api.votepipe.com/v1/organization/test-discord-webhook', {
method: 'POST',
headers: {
'Authorization': 'Bearer mr_live_your_api_key_here',
'Content-Type': 'application/json'
},
body: JSON.stringify({
webhook_url: 'https://discord.com/api/webhooks/123456789/abcdefghijk',
message_type: 'embed',
embed_template: {
color: 65280,
title: '๐ New Vote Received!',
description: '**{{voter_name}}** just voted on **{{provider_name}}**',
fields: [{name: 'Vote ID', value: '{{vote_id}}', inline: true}],
footer: {text: 'VotePipe โข Vote Notification'},
timestamp: '{{received_at}}'
}
})
});
const data = await response.json();