Test webhook endpoint
curl --request POST \
--url https://api.teleship.com/api/webhooks/test \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"shipmentIds": [
"ship_123",
"ship_456"
]
}
'import requests
url = "https://api.teleship.com/api/webhooks/test"
payload = { "shipmentIds": ["ship_123", "ship_456"] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({shipmentIds: ['ship_123', 'ship_456']})
};
fetch('https://api.teleship.com/api/webhooks/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.teleship.com/api/webhooks/test",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'shipmentIds' => [
'ship_123',
'ship_456'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.teleship.com/api/webhooks/test"
payload := strings.NewReader("{\n \"shipmentIds\": [\n \"ship_123\",\n \"ship_456\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
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.teleship.com/api/webhooks/test")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"shipmentIds\": [\n \"ship_123\",\n \"ship_456\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.teleship.com/api/webhooks/test")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"shipmentIds\": [\n \"ship_123\",\n \"ship_456\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "<string>",
"webhooksNotified": 123,
"results": [
{
"shipmentId": "<string>",
"success": true,
"message": "<string>",
"webhooksNotified": 123
}
]
}{
"messages": [
{
"code": 123,
"level": "error",
"timestamp": "2024-01-01T00:00:00.00Z",
"message": "An error occurred",
"details": [
"Missing required field"
]
}
]
}{
"messages": [
{
"code": 123,
"level": "error",
"timestamp": "2024-01-01T00:00:00.00Z",
"message": "An error occurred",
"details": [
"Missing required field"
]
}
]
}{
"messages": [
{
"code": 123,
"level": "error",
"timestamp": "2024-01-01T00:00:00.00Z",
"message": "An error occurred",
"details": [
"Missing required field"
]
}
]
}Shipping services
Test webhook endpoint
Send a test webhook notification to verify your endpoint is working correctly.
Overview
This endpoint allows you to test your webhook implementation by sending a sample webhook payload to your registered endpoints. This is useful for:
- Verifying your webhook handler is working correctly
- Testing signature verification
- Debugging webhook processing logic
- Ensuring your endpoint can handle the expected payload structure
How it works
- Provide shipment IDs - Specify which shipments to use for the test
- Send test webhooks - Teleship sends test notifications to all your enabled webhooks
- Verify results - Check the response to see which webhooks were notified successfully
Test Payload
The test webhook will send a shipment.updated event with real shipment data, allowing you to test with actual data structure.
Response
The response includes:
- Overall success status
- Number of webhooks notified
- Detailed results for each shipment
- Any errors that occurred during testing
Example Usage
curl -X POST "https://api.teleship.com/api/webhooks/test" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"shipmentIds": ["ship_123", "ship_456"]
}'
Example Response
{
"success": true,
"message": "Successfully tested webhooks for 2/2 shipments",
"webhooksNotified": 4,
"results": [
{
"shipmentId": "ship_123",
"success": true,
"message": "Test webhook sent successfully to 2 webhook(s)",
"webhooksNotified": 2
},
{
"shipmentId": "ship_456",
"success": true,
"message": "Test webhook sent successfully to 2 webhook(s)",
"webhooksNotified": 2
}
]
}
Troubleshooting
If webhook tests fail:
- Check endpoint URL - Ensure your webhook endpoint is accessible
- Verify signature handling - Make sure your signature verification is working
- Check response time - Ensure your endpoint responds within 30 seconds
- Review logs - Check your webhook handler logs for errors
- Test manually - Use tools like ngrok to test locally during development
POST
/
api
/
webhooks
/
test
Test webhook endpoint
curl --request POST \
--url https://api.teleship.com/api/webhooks/test \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"shipmentIds": [
"ship_123",
"ship_456"
]
}
'import requests
url = "https://api.teleship.com/api/webhooks/test"
payload = { "shipmentIds": ["ship_123", "ship_456"] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({shipmentIds: ['ship_123', 'ship_456']})
};
fetch('https://api.teleship.com/api/webhooks/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.teleship.com/api/webhooks/test",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'shipmentIds' => [
'ship_123',
'ship_456'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.teleship.com/api/webhooks/test"
payload := strings.NewReader("{\n \"shipmentIds\": [\n \"ship_123\",\n \"ship_456\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
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.teleship.com/api/webhooks/test")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"shipmentIds\": [\n \"ship_123\",\n \"ship_456\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.teleship.com/api/webhooks/test")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"shipmentIds\": [\n \"ship_123\",\n \"ship_456\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "<string>",
"webhooksNotified": 123,
"results": [
{
"shipmentId": "<string>",
"success": true,
"message": "<string>",
"webhooksNotified": 123
}
]
}{
"messages": [
{
"code": 123,
"level": "error",
"timestamp": "2024-01-01T00:00:00.00Z",
"message": "An error occurred",
"details": [
"Missing required field"
]
}
]
}{
"messages": [
{
"code": 123,
"level": "error",
"timestamp": "2024-01-01T00:00:00.00Z",
"message": "An error occurred",
"details": [
"Missing required field"
]
}
]
}{
"messages": [
{
"code": 123,
"level": "error",
"timestamp": "2024-01-01T00:00:00.00Z",
"message": "An error occurred",
"details": [
"Missing required field"
]
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Array of shipment IDs to test webhook notifications for
Example:
["ship_123", "ship_456"]
Was this page helpful?