Test Webhook
curl --request POST \
--url https://api.example.com/webhooks/{id}/test \
--header 'Authorization: <authorization>'import requests
url = "https://api.example.com/webhooks/{id}/test"
headers = {"Authorization": "<authorization>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: '<authorization>'}};
fetch('https://api.example.com/webhooks/{id}/test', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/webhooks/{id}/test",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/webhooks/{id}/test"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/webhooks/{id}/test")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/webhooks/{id}/test")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"success": true,
"deliveryId": "<string>",
"httpStatus": 123,
"durationMs": 123,
"message": "<string>"
}Webhooks
Test Webhook
POST
/
webhooks
/
{id}
/
test
Test Webhook
curl --request POST \
--url https://api.example.com/webhooks/{id}/test \
--header 'Authorization: <authorization>'import requests
url = "https://api.example.com/webhooks/{id}/test"
headers = {"Authorization": "<authorization>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: '<authorization>'}};
fetch('https://api.example.com/webhooks/{id}/test', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/webhooks/{id}/test",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/webhooks/{id}/test"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/webhooks/{id}/test")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/webhooks/{id}/test")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"success": true,
"deliveryId": "<string>",
"httpStatus": 123,
"durationMs": 123,
"message": "<string>"
}Sends a test ping event to verify webhook connectivity and signature validation.
Overview
Use this endpoint to verify that your webhook endpoint is correctly configured and can receive and validate webhook payloads. The test sends aping event to your endpoint.
The webhook must be subscribed to the
ping event for testing to work.Authentication
string
required
Bearer token with
write:webhooks scopePath Parameters
string
required
The webhook configuration ID (UUID v4)
Response
boolean
Whether the test was successful
string
Unique delivery ID for tracking (only on success)
number
HTTP status code returned by your endpoint (only on success)
number
Request duration in milliseconds (only on success)
string
Human-readable result message
Example Request
curl -X POST https://api.instaview.sk/webhooks/550e8400-e29b-41d4-a716-446655440000/test \
-H "Authorization: Bearer sk_your_key_here"
const webhookId = '550e8400-e29b-41d4-a716-446655440000';
const response = await fetch(
`https://api.instaview.sk/webhooks/${webhookId}/test`,
{
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.INSTAVIEW_API_KEY}`
}
}
);
const data = await response.json();
if (data.success) {
console.log('✅ Webhook test successful');
console.log(` Response time: ${data.durationMs}ms`);
console.log(` HTTP status: ${data.httpStatus}`);
} else {
console.error('❌ Webhook test failed:', data.message);
}
webhook_id = '550e8400-e29b-41d4-a716-446655440000'
response = requests.post(
f'https://api.instaview.sk/webhooks/{webhook_id}/test',
headers={
'Authorization': f'Bearer {os.environ["INSTAVIEW_API_KEY"]}'
}
)
data = response.json()
if data['success']:
print('✅ Webhook test successful')
print(f' Response time: {data["durationMs"]}ms')
print(f' HTTP status: {data["httpStatus"]}')
else:
print(f'❌ Webhook test failed: {data["message"]}')
Example Responses
Successful Test
{
"success": true,
"deliveryId": "delivery-uuid",
"httpStatus": 200,
"durationMs": 156,
"message": "Webhook test successful!"
}
Failed Test
{
"success": false,
"message": "Webhook test failed: Connection timeout"
}
Missing Ping Event Subscription
{
"success": false,
"message": "Webhook is not subscribed to ping events. Add the ping event to the webhook configuration."
}
Webhook Disabled
{
"success": false,
"message": "No delivery was created. This may indicate the webhook is disabled or circuit breaker is open."
}
Test Payload
Your endpoint will receive this payload during testing:{
"event": "ping",
"timestamp": "2024-01-20T14:30:00.000Z",
"deliveryId": "delivery-uuid",
"data": {
"message": "Test ping from InstaView webhook system"
}
}
Verifying Signature in Test
Use the test to verify your signature validation is working correctly:// Configure Express to preserve raw body for signature verification
app.post('/webhooks/instaview',
express.raw({ type: 'application/json' }),
(req, res) => {
const signature = req.headers['x-webhook-signature'];
const payload = req.body.toString(); // Now this is the raw buffer
if (!verifySignature(payload, signature, process.env.WEBHOOK_SECRET)) {
console.error('Signature verification failed');
return res.status(401).send('Invalid signature');
}
const event = JSON.parse(payload);
if (event.event === 'ping') {
console.log('Ping test received successfully');
console.log('Message:', event.data.message);
}
res.status(200).send('OK');
}
);
Troubleshooting
Test fails with timeout
Test fails with timeout
- Ensure your endpoint is publicly accessible
- Check if your firewall allows incoming connections
- Verify your endpoint responds within 30 seconds
Test fails with connection refused
Test fails with connection refused
- Verify the webhook URL is correct
- Check if your server is running
- Ensure the port is open and accessible
Test fails with 401/403
Test fails with 401/403
- Check your custom Authorization header value
- Verify your endpoint’s authentication logic
- Ensure signature verification is working correctly
'Not subscribed to ping events'
'Not subscribed to ping events'
Add the ping event to your webhook:
await fetch(`/webhooks/${webhookId}`, {
method: 'PATCH',
headers: { 'Authorization': `Bearer ${apiKey}`, 'Content-Type': 'application/json' },
body: JSON.stringify({
events: ["ping", "conversation.completed", "analysis.completed"]
})
});
Related
Webhooks Guide
Learn about signature verification
Update Webhook
Add ping event subscription