Webhooks
Manage the endpoints SemaLink posts events to. A live key manages live endpoints; a test key the sandbox's.
The webhook endpoint object
| Field | Type | Description |
|---|---|---|
id | string | The endpoint's id. |
object | string | Always webhook_endpoint. |
livemode | boolean | A live endpoint gets live events; a sandbox (test) one the sandbox's. |
url | string | |
description | string or null | |
events | array of strings | |
enabled | boolean | |
failing_since | string or null | Deliveries have failed in a row since then; null while they succeed. |
created_at | string | |
updated_at | string |
Example
{
"id": "whe_5e4d3c2b1a0f4e9d8c7b6a5f4e3d2c1b",
"object": "webhook_endpoint",
"livemode": true,
"url": "https://greenhill.co.ke/semalink/events",
"description": "Delivery reports for the billing server",
"events": [
"message.delivered",
"message.failed"
],
"enabled": true,
"failing_since": null,
"created_at": "2026-12-01T07:30:00.000Z",
"updated_at": "2026-12-01T07:30:00.000Z"
}2
3
4
5
6
7
8
9
10
11
12
13
14
15
List webhook endpoints
/v1/webhooksScope: webhooks:manageA live key manages the live endpoints; a sandbox key the test ones, which get the sandbox's events.
Returns
200 OK The endpoints. A list of webhook endpoint objects.
Errors
Like any request, it can answer invalid_api_key key_revoked key_expired scope_missing ip_not_allowed browser_requests_not_allowed api_blocked account_suspended rate_limited internal_error request_timeout.
Request
curl https://api.semalink.africa/v1/webhooks \
-H "Authorization: Bearer $SEMALINK_API_KEY"2
const response = await fetch('https://api.semalink.africa/v1/webhooks', {
headers: {
Authorization: `Bearer ${process.env.SEMALINK_API_KEY}`,
},
});
const page = await response.json();
console.log(response.status, page);2
3
4
5
6
7
8
import os
import requests
response = requests.get(
"https://api.semalink.africa/v1/webhooks",
headers={
"Authorization": f"Bearer {os.environ['SEMALINK_API_KEY']}",
},
timeout=30,
)
page = response.json()
print(response.status_code, page)2
3
4
5
6
7
8
9
10
11
12
13
14
<?php
$ch = curl_init('https://api.semalink.africa/v1/webhooks');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('SEMALINK_API_KEY'),
],
]);
$page = json_decode(curl_exec($ch), true);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
print_r($page);2
3
4
5
6
7
8
9
10
11
12
13
14
Response
{
"object": "list",
"data": [
{
"id": "whe_5e4d3c2b1a0f4e9d8c7b6a5f4e3d2c1b",
"object": "webhook_endpoint",
"livemode": true,
"url": "https://greenhill.co.ke/semalink/events",
"description": "Delivery reports for the billing server",
"events": [
"message.delivered",
"message.failed"
],
"enabled": true,
"failing_since": null,
"created_at": "2026-12-01T07:30:00.000Z",
"updated_at": "2026-12-01T07:30:00.000Z"
}
],
"has_more": false,
"next_cursor": null
}2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
{
"error": {
"type": "authentication_error",
"code": "invalid_api_key",
"message": "This API key isn't one we know. Check it was copied whole, or make a new one in Developer > API keys.",
"doc_url": "https://docs.semalink.africa/errors#invalid_api_key",
"request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
}
}2
3
4
5
6
7
8
9
{
"error": {
"type": "permission_error",
"code": "scope_missing",
"message": "This API key doesn't have the webhooks:manage scope this request needs.",
"doc_url": "https://docs.semalink.africa/errors#scope_missing",
"request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
}
}2
3
4
5
6
7
8
9
Create a webhook endpoint
/v1/webhooksScope: webhooks:manageA live key manages the live endpoints; a sandbox key the test ones, which get the sandbox's events. The signing secret is shown this once. Each delivery is signed: X-SemaLink-Signature-256 is t=<unix time>,v1=<hex HMAC-SHA256 of "<t>.<body>" with the secret>; refuse one older than 5 minutes.
Headers
| Name | Type | Required | Description |
|---|---|---|---|
Idempotency-Key | string | Optional | Any unique string (a UUID): a retry with the same key and body within 24 hours gets the first answer, with Idempotent-Replayed: true. |
Body
| Name | Type | Required | Description |
|---|---|---|---|
url | string (URL) | Required | Where events are posted: a public https:// address. |
events | array of strings | Required | |
description | string | Optional |
Returns
201 Created Created, with its secret. A webhook endpoint object with secret.
| Field | Type | Description |
|---|---|---|
secret | string | The signing secret, shown this once. |
Errors
| Status | Code | For example |
|---|---|---|
| 400 | parameter_missing | Missing required parameter: from. |
| 400 | parameter_invalid | Invalid send_at: choose a time at least 5 minutes from now, or leave it out to send now. |
| 400 | parameter_unknown | Unknown parameter: sender. |
| 422 | url_not_https | Webhooks must use https. Use a URL that starts with https://. |
| 422 | url_private_address | intranet.local points at a private network address, which SemaLink can't deliver to. Use a public address. |
Like any POST, it can also answer invalid_json idempotency_key_invalid invalid_api_key key_revoked key_expired scope_missing ip_not_allowed browser_requests_not_allowed api_blocked account_suspended idempotency_key_reused idempotency_key_in_use idempotency_answer_unavailable request_too_large unsupported_media_type rate_limited internal_error request_timeout.
Request
curl https://api.semalink.africa/v1/webhooks \
-H "Authorization: Bearer $SEMALINK_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"url": "https://greenhill.co.ke/semalink/events",
"events": [
"message.delivered",
"message.failed"
]
}'2
3
4
5
6
7
8
9
10
11
const response = await fetch('https://api.semalink.africa/v1/webhooks', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.SEMALINK_API_KEY}`,
'Content-Type': 'application/json',
'Idempotency-Key': crypto.randomUUID(), // keep it if you retry
},
body: JSON.stringify({
url: 'https://greenhill.co.ke/semalink/events',
events: ['message.delivered', 'message.failed'],
}),
});
const webhookEndpoint = await response.json();
console.log(response.status, webhookEndpoint);2
3
4
5
6
7
8
9
10
11
12
13
14
15
import os
import uuid
import requests
response = requests.post(
"https://api.semalink.africa/v1/webhooks",
headers={
"Authorization": f"Bearer {os.environ['SEMALINK_API_KEY']}",
"Idempotency-Key": str(uuid.uuid4()), # keep it if you retry
},
json={
"url": "https://greenhill.co.ke/semalink/events",
"events": ["message.delivered", "message.failed"],
},
timeout=30,
)
webhook_endpoint = response.json()
print(response.status_code, webhook_endpoint)2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?php
$ch = curl_init('https://api.semalink.africa/v1/webhooks');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('SEMALINK_API_KEY'),
'Content-Type: application/json',
'Idempotency-Key: ' . bin2hex(random_bytes(16)), // keep it if you retry
],
CURLOPT_POSTFIELDS => json_encode([
'url' => 'https://greenhill.co.ke/semalink/events',
'events' => ['message.delivered', 'message.failed'],
]),
]);
$webhookEndpoint = json_decode(curl_exec($ch), true);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
print_r($webhookEndpoint);2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Response
{
"id": "whe_5e4d3c2b1a0f4e9d8c7b6a5f4e3d2c1b",
"object": "webhook_endpoint",
"livemode": true,
"url": "https://greenhill.co.ke/semalink/events",
"description": "Delivery reports for the billing server",
"events": [
"message.delivered",
"message.failed"
],
"enabled": true,
"failing_since": null,
"created_at": "2026-12-01T07:30:00.000Z",
"updated_at": "2026-12-01T07:30:00.000Z",
"secret": "whsec_2f7a9c1e4b6d8f0a3c5e7b9d1f3a5c7e9b1d3f5a7c9e1b3d"
}2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
{
"error": {
"type": "invalid_request_error",
"code": "url_not_https",
"message": "Webhooks must use https. Use a URL that starts with https://.",
"doc_url": "https://docs.semalink.africa/errors#url_not_https",
"request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
}
}2
3
4
5
6
7
8
9
{
"error": {
"type": "invalid_request_error",
"code": "parameter_missing",
"message": "Missing required parameter: from.",
"param": "from",
"doc_url": "https://docs.semalink.africa/errors#parameter_missing",
"request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
}
}2
3
4
5
6
7
8
9
10
Get a webhook endpoint
/v1/webhooks/{id}Scope: webhooks:manageA live key manages the live endpoints; a sandbox key the test ones, which get the sandbox's events.
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Required | The whe_... id. |
Returns
200 OK The endpoint. A webhook endpoint object.
Errors
| Status | Code | For example |
|---|---|---|
| 404 | resource_not_found | There's no webhook endpoint whe_5e4d3c2b1a0f4e9d8c7b6a5f4e3d2c1b for this key. |
Like any request, it can also answer invalid_api_key key_revoked key_expired scope_missing ip_not_allowed browser_requests_not_allowed api_blocked account_suspended rate_limited internal_error request_timeout.
Request
curl https://api.semalink.africa/v1/webhooks/whe_5e4d3c2b1a0f4e9d8c7b6a5f4e3d2c1b \
-H "Authorization: Bearer $SEMALINK_API_KEY"2
const response = await fetch('https://api.semalink.africa/v1/webhooks/whe_5e4d3c2b1a0f4e9d8c7b6a5f4e3d2c1b', {
headers: {
Authorization: `Bearer ${process.env.SEMALINK_API_KEY}`,
},
});
const webhookEndpoint = await response.json();
console.log(response.status, webhookEndpoint);2
3
4
5
6
7
8
import os
import requests
response = requests.get(
"https://api.semalink.africa/v1/webhooks/whe_5e4d3c2b1a0f4e9d8c7b6a5f4e3d2c1b",
headers={
"Authorization": f"Bearer {os.environ['SEMALINK_API_KEY']}",
},
timeout=30,
)
webhook_endpoint = response.json()
print(response.status_code, webhook_endpoint)2
3
4
5
6
7
8
9
10
11
12
13
14
<?php
$ch = curl_init('https://api.semalink.africa/v1/webhooks/whe_5e4d3c2b1a0f4e9d8c7b6a5f4e3d2c1b');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('SEMALINK_API_KEY'),
],
]);
$webhookEndpoint = json_decode(curl_exec($ch), true);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
print_r($webhookEndpoint);2
3
4
5
6
7
8
9
10
11
12
13
14
Response
{
"id": "whe_5e4d3c2b1a0f4e9d8c7b6a5f4e3d2c1b",
"object": "webhook_endpoint",
"livemode": true,
"url": "https://greenhill.co.ke/semalink/events",
"description": "Delivery reports for the billing server",
"events": [
"message.delivered",
"message.failed"
],
"enabled": true,
"failing_since": null,
"created_at": "2026-12-01T07:30:00.000Z",
"updated_at": "2026-12-01T07:30:00.000Z"
}2
3
4
5
6
7
8
9
10
11
12
13
14
15
{
"error": {
"type": "invalid_request_error",
"code": "resource_not_found",
"message": "There's no webhook endpoint whe_5e4d3c2b1a0f4e9d8c7b6a5f4e3d2c1b for this key.",
"param": "id",
"doc_url": "https://docs.semalink.africa/errors#resource_not_found",
"request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
}
}2
3
4
5
6
7
8
9
10
{
"error": {
"type": "authentication_error",
"code": "invalid_api_key",
"message": "This API key isn't one we know. Check it was copied whole, or make a new one in Developer > API keys.",
"doc_url": "https://docs.semalink.africa/errors#invalid_api_key",
"request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
}
}2
3
4
5
6
7
8
9
Update a webhook endpoint
/v1/webhooks/{id}Scope: webhooks:manageIts URL, events, description, or enabled (false stops deliveries and cancels what was waiting).
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Required | The whe_... id. |
Body
| Name | Type | Required | Description |
|---|---|---|---|
url | string (URL) | Optional | Where events are posted: a public https:// address. |
events | array of strings | Optional | |
description | string or null | Optional | |
enabled | boolean | Optional | false stops deliveries (what was waiting is cancelled); true starts them again. |
Returns
200 OK The endpoint. A webhook endpoint object.
Errors
| Status | Code | For example |
|---|---|---|
| 400 | parameter_missing | Missing required parameter: from. |
| 400 | parameter_invalid | Invalid send_at: choose a time at least 5 minutes from now, or leave it out to send now. |
| 400 | parameter_unknown | Unknown parameter: sender. |
| 400 | invalid_json | The body isn't valid JSON. |
| 400 | idempotency_key_invalid | An Idempotency-Key is 1 to 255 characters. |
| 404 | resource_not_found | There's no webhook endpoint whe_5e4d3c2b1a0f4e9d8c7b6a5f4e3d2c1b for this key. |
| 413 | request_too_large | The body is too large. |
| 415 | unsupported_media_type | Send the body as JSON, with Content-Type: application/json. |
| 422 | url_not_https | Webhooks must use https. Use a URL that starts with https://. |
| 422 | url_private_address | intranet.local points at a private network address, which SemaLink can't deliver to. Use a public address. |
Like any request, it can also answer invalid_api_key key_revoked key_expired scope_missing ip_not_allowed browser_requests_not_allowed api_blocked account_suspended rate_limited internal_error request_timeout.
Request
curl -X PATCH https://api.semalink.africa/v1/webhooks/whe_5e4d3c2b1a0f4e9d8c7b6a5f4e3d2c1b \
-H "Authorization: Bearer $SEMALINK_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"events": [
"message.sent",
"message.delivered",
"message.failed"
]
}'2
3
4
5
6
7
8
9
10
const response = await fetch('https://api.semalink.africa/v1/webhooks/whe_5e4d3c2b1a0f4e9d8c7b6a5f4e3d2c1b', {
method: 'PATCH',
headers: {
Authorization: `Bearer ${process.env.SEMALINK_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
events: ['message.sent', 'message.delivered', 'message.failed'],
}),
});
const webhookEndpoint = await response.json();
console.log(response.status, webhookEndpoint);2
3
4
5
6
7
8
9
10
11
12
13
import os
import requests
response = requests.patch(
"https://api.semalink.africa/v1/webhooks/whe_5e4d3c2b1a0f4e9d8c7b6a5f4e3d2c1b",
headers={
"Authorization": f"Bearer {os.environ['SEMALINK_API_KEY']}",
},
json={
"events": ["message.sent", "message.delivered", "message.failed"],
},
timeout=30,
)
webhook_endpoint = response.json()
print(response.status_code, webhook_endpoint)2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?php
$ch = curl_init('https://api.semalink.africa/v1/webhooks/whe_5e4d3c2b1a0f4e9d8c7b6a5f4e3d2c1b');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'PATCH',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('SEMALINK_API_KEY'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'events' => ['message.sent', 'message.delivered', 'message.failed'],
]),
]);
$webhookEndpoint = json_decode(curl_exec($ch), true);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
print_r($webhookEndpoint);2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Response
{
"id": "whe_5e4d3c2b1a0f4e9d8c7b6a5f4e3d2c1b",
"object": "webhook_endpoint",
"livemode": true,
"url": "https://greenhill.co.ke/semalink/events",
"description": "Delivery reports for the billing server",
"events": [
"message.delivered",
"message.failed"
],
"enabled": true,
"failing_since": null,
"created_at": "2026-12-01T07:30:00.000Z",
"updated_at": "2026-12-01T07:30:00.000Z"
}2
3
4
5
6
7
8
9
10
11
12
13
14
15
{
"error": {
"type": "invalid_request_error",
"code": "url_not_https",
"message": "Webhooks must use https. Use a URL that starts with https://.",
"doc_url": "https://docs.semalink.africa/errors#url_not_https",
"request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
}
}2
3
4
5
6
7
8
9
{
"error": {
"type": "invalid_request_error",
"code": "resource_not_found",
"message": "There's no webhook endpoint whe_5e4d3c2b1a0f4e9d8c7b6a5f4e3d2c1b for this key.",
"param": "id",
"doc_url": "https://docs.semalink.africa/errors#resource_not_found",
"request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
}
}2
3
4
5
6
7
8
9
10
Delete a webhook endpoint
/v1/webhooks/{id}Scope: webhooks:manageIt gets nothing more, and what was waiting for it goes.
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Required | The whe_... id. |
Returns
200 OK Deleted.
| Field | Type | Description |
|---|---|---|
id | string | |
object | string | Always webhook_endpoint. |
deleted | boolean | Always true. |
Errors
| Status | Code | For example |
|---|---|---|
| 404 | resource_not_found | There's no webhook endpoint whe_5e4d3c2b1a0f4e9d8c7b6a5f4e3d2c1b for this key. |
Like any request, it can also answer invalid_api_key key_revoked key_expired scope_missing ip_not_allowed browser_requests_not_allowed api_blocked account_suspended rate_limited internal_error request_timeout.
Request
curl -X DELETE https://api.semalink.africa/v1/webhooks/whe_5e4d3c2b1a0f4e9d8c7b6a5f4e3d2c1b \
-H "Authorization: Bearer $SEMALINK_API_KEY"2
const response = await fetch('https://api.semalink.africa/v1/webhooks/whe_5e4d3c2b1a0f4e9d8c7b6a5f4e3d2c1b', {
method: 'DELETE',
headers: {
Authorization: `Bearer ${process.env.SEMALINK_API_KEY}`,
},
});
const webhookEndpoint = await response.json();
console.log(response.status, webhookEndpoint);2
3
4
5
6
7
8
9
import os
import requests
response = requests.delete(
"https://api.semalink.africa/v1/webhooks/whe_5e4d3c2b1a0f4e9d8c7b6a5f4e3d2c1b",
headers={
"Authorization": f"Bearer {os.environ['SEMALINK_API_KEY']}",
},
timeout=30,
)
webhook_endpoint = response.json()
print(response.status_code, webhook_endpoint)2
3
4
5
6
7
8
9
10
11
12
13
14
<?php
$ch = curl_init('https://api.semalink.africa/v1/webhooks/whe_5e4d3c2b1a0f4e9d8c7b6a5f4e3d2c1b');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'DELETE',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('SEMALINK_API_KEY'),
],
]);
$webhookEndpoint = json_decode(curl_exec($ch), true);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
print_r($webhookEndpoint);2
3
4
5
6
7
8
9
10
11
12
13
14
15
Response
{
"id": "whe_5e4d3c2b1a0f4e9d8c7b6a5f4e3d2c1b",
"object": "webhook_endpoint",
"deleted": true
}2
3
4
5
{
"error": {
"type": "invalid_request_error",
"code": "resource_not_found",
"message": "There's no webhook endpoint whe_5e4d3c2b1a0f4e9d8c7b6a5f4e3d2c1b for this key.",
"param": "id",
"doc_url": "https://docs.semalink.africa/errors#resource_not_found",
"request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
}
}2
3
4
5
6
7
8
9
10
{
"error": {
"type": "authentication_error",
"code": "invalid_api_key",
"message": "This API key isn't one we know. Check it was copied whole, or make a new one in Developer > API keys.",
"doc_url": "https://docs.semalink.africa/errors#invalid_api_key",
"request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
}
}2
3
4
5
6
7
8
9
Send a test event
/v1/webhooks/{id}/testScope: webhooks:managePosts one webhook.test event now, signed as every delivery is, and says how the endpoint answered. Never retried.
Headers
| Name | Type | Required | Description |
|---|---|---|---|
Idempotency-Key | string | Optional | Any unique string (a UUID): a retry with the same key and body within 24 hours gets the first answer, with Idempotent-Replayed: true. |
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Required | The whe_... id. |
Returns
200 OK How the endpoint answered. A webhook test object.
Errors
| Status | Code | For example |
|---|---|---|
| 404 | resource_not_found | There's no webhook endpoint whe_5e4d3c2b1a0f4e9d8c7b6a5f4e3d2c1b for this key. |
Like any POST, it can also answer invalid_json idempotency_key_invalid invalid_api_key key_revoked key_expired scope_missing ip_not_allowed browser_requests_not_allowed api_blocked account_suspended idempotency_key_reused idempotency_key_in_use idempotency_answer_unavailable request_too_large unsupported_media_type rate_limited internal_error request_timeout.
Request
curl -X POST https://api.semalink.africa/v1/webhooks/whe_5e4d3c2b1a0f4e9d8c7b6a5f4e3d2c1b/test \
-H "Authorization: Bearer $SEMALINK_API_KEY" \
-H "Idempotency-Key: $(uuidgen)"2
3
const response = await fetch('https://api.semalink.africa/v1/webhooks/whe_5e4d3c2b1a0f4e9d8c7b6a5f4e3d2c1b/test', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.SEMALINK_API_KEY}`,
'Idempotency-Key': crypto.randomUUID(), // keep it if you retry
},
});
const webhookTest = await response.json();
console.log(response.status, webhookTest);2
3
4
5
6
7
8
9
10
import os
import uuid
import requests
response = requests.post(
"https://api.semalink.africa/v1/webhooks/whe_5e4d3c2b1a0f4e9d8c7b6a5f4e3d2c1b/test",
headers={
"Authorization": f"Bearer {os.environ['SEMALINK_API_KEY']}",
"Idempotency-Key": str(uuid.uuid4()), # keep it if you retry
},
timeout=30,
)
webhook_test = response.json()
print(response.status_code, webhook_test)2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<?php
$ch = curl_init('https://api.semalink.africa/v1/webhooks/whe_5e4d3c2b1a0f4e9d8c7b6a5f4e3d2c1b/test');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('SEMALINK_API_KEY'),
'Idempotency-Key: ' . bin2hex(random_bytes(16)), // keep it if you retry
],
]);
$webhookTest = json_decode(curl_exec($ch), true);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
print_r($webhookTest);2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Response
{
"object": "webhook_test",
"event": "evt_9d8c7b6a5f4e4d3c2b1a0f9e8d7c6b5a",
"success": true,
"status_code": 200,
"error": null,
"duration_ms": 184
}2
3
4
5
6
7
8
{
"error": {
"type": "invalid_request_error",
"code": "resource_not_found",
"message": "There's no webhook endpoint whe_5e4d3c2b1a0f4e9d8c7b6a5f4e3d2c1b for this key.",
"param": "id",
"doc_url": "https://docs.semalink.africa/errors#resource_not_found",
"request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
}
}2
3
4
5
6
7
8
9
10
{
"error": {
"type": "authentication_error",
"code": "invalid_api_key",
"message": "This API key isn't one we know. Check it was copied whole, or make a new one in Developer > API keys.",
"doc_url": "https://docs.semalink.africa/errors#invalid_api_key",
"request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
}
}2
3
4
5
6
7
8
9
The webhook test object
| Field | Type | Description |
|---|---|---|
object | string | Always webhook_test. |
event | string | The test event sent (type webhook.test). |
success | boolean | The endpoint answered 2xx. |
status_code | integer or null | |
error | string or null | |
duration_ms | integer or null |
Example
{
"object": "webhook_test",
"event": "evt_9d8c7b6a5f4e4d3c2b1a0f9e8d7c6b5a",
"success": true,
"status_code": 200,
"error": null,
"duration_ms": 184
}2
3
4
5
6
7
8