JT Noble SMS documentation home

Webhooks

Every webhooks route, with request, response, errors and samples in curl, Node, Python and PHP.

See the overview for sign-in and the error shape.

Webhook delivery log

GET /v1/webhook-deliveries

Who can call it: Any API key, or a dashboard session token.

QueryTypeRequiredDefaultMeaning
pageintegerNo0Page number, starting at 0.
limitintegerNo50Items per page.
successbooleanNo
event_typestringNo
curl -X GET "https://api.sms.jtnoble.com/v1/webhook-deliveries" \
  -H "Authorization: Bearer $JTSMS_API_KEY"
const resp = await fetch('https://api.sms.jtnoble.com/v1/webhook-deliveries', {
  method: 'GET',
  headers: { Authorization: `Bearer ${process.env.JTSMS_API_KEY}` },
});
console.log(resp.status, await resp.text());
import os
import requests

resp = requests.get(
    "https://api.sms.jtnoble.com/v1/webhook-deliveries",
    headers={"Authorization": f"Bearer {os.environ['JTSMS_API_KEY']}"},
    timeout=30,
)
print(resp.status_code, resp.text)
<?php
$ch = curl_init('https://api.sms.jtnoble.com/v1/webhook-deliveries');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('JTSMS_API_KEY')],
]);
$body = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_RESPONSE_CODE), ' ', $body, PHP_EOL;

HTTP 200:

{
  "deliveries": [],
  "total": 0,
  "page": 0,
  "limit": 2,
  "failed_24h": 0
}
HTTPcodeMessage
401unauthorizedNot authenticated
429rate_limitedToo many requests. Try again in a moment.

Send a webhook again

POST /v1/webhook-deliveries/{delivery_id}/replay

Re-POST a past webhook payload to your current endpoint, freshly signed.

Who can call it: API key with the webhooks scope, or a dashboard session token.

Path valueTypeMeaning
delivery_idintegerThe delivery id from the log.
curl -X POST "https://api.sms.jtnoble.com/v1/webhook-deliveries/DELIVERY_ID/replay" \
  -H "Authorization: Bearer $JTSMS_API_KEY"
const resp = await fetch('https://api.sms.jtnoble.com/v1/webhook-deliveries/DELIVERY_ID/replay', {
  method: 'POST',
  headers: { Authorization: `Bearer ${process.env.JTSMS_API_KEY}` },
});
console.log(resp.status, await resp.text());
import os
import requests

resp = requests.post(
    "https://api.sms.jtnoble.com/v1/webhook-deliveries/DELIVERY_ID/replay",
    headers={"Authorization": f"Bearer {os.environ['JTSMS_API_KEY']}"},
    timeout=30,
)
print(resp.status_code, resp.text)
<?php
$ch = curl_init('https://api.sms.jtnoble.com/v1/webhook-deliveries/DELIVERY_ID/replay');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('JTSMS_API_KEY')],
]);
$body = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_RESPONSE_CODE), ' ', $body, PHP_EOL;

HTTP 200:

{
  "replayed": true,
  "success": true,
  "delivery": {
    "id": 13,
    "event_type": "dlr",
    "url": "https://example.mw/sms/dlr",
    "status_code": 200,
    "success": true,
    "attempt": 1
  }
}
HTTPcodeMessage
400bad_requestWebhook URL is not publicly reachable
401unauthorizedNot authenticated
403insufficient_scopeThis API key is not authorised for this action.
404not_foundDelivery not found
429rate_limitedToo many requests. Try again in a moment.

Read webhook settings

GET /v1/webhooks

Who can call it: API key with the webhooks scope, or a dashboard session token.

curl -X GET "https://api.sms.jtnoble.com/v1/webhooks" \
  -H "Authorization: Bearer $JTSMS_API_KEY"
const resp = await fetch('https://api.sms.jtnoble.com/v1/webhooks', {
  method: 'GET',
  headers: { Authorization: `Bearer ${process.env.JTSMS_API_KEY}` },
});
console.log(resp.status, await resp.text());
import os
import requests

resp = requests.get(
    "https://api.sms.jtnoble.com/v1/webhooks",
    headers={"Authorization": f"Bearer {os.environ['JTSMS_API_KEY']}"},
    timeout=30,
)
print(resp.status_code, resp.text)
<?php
$ch = curl_init('https://api.sms.jtnoble.com/v1/webhooks');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('JTSMS_API_KEY')],
]);
$body = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_RESPONSE_CODE), ' ', $body, PHP_EOL;

HTTP 200:

{
  "dlr_url": null,
  "mo_url": null,
  "campaign_url": null,
  "signing_secret": "whsec_YOUR_SECRET",
  "is_active": true
}
HTTPcodeMessage
401unauthorizedNot authenticated
403insufficient_scopeThis API key is not authorised for this action.
429rate_limitedToo many requests. Try again in a moment.

Set webhook URLs

PUT /v1/webhooks

Who can call it: API key with the webhooks scope, or a dashboard session token.

Body (JSON):

FieldTypeRequiredDefaultMeaning
dlr_urlstringNoReceives delivery reports. Empty string clears it.
mo_urlstringNoReceives inbound messages. Empty string clears it.
campaign_urlstringNoReceives campaign events. Empty string clears it.
is_activebooleanNoOn or off.
curl -X PUT "https://api.sms.jtnoble.com/v1/webhooks" \
  -H "Authorization: Bearer $JTSMS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"dlr_url":"https://example.mw/sms/dlr","mo_url":"https://example.mw/sms/inbound","campaign_url":"https://example.mw/sms/campaign"}'
const resp = await fetch('https://api.sms.jtnoble.com/v1/webhooks', {
  method: 'PUT',
  headers: { Authorization: `Bearer ${process.env.JTSMS_API_KEY}`, 'Content-Type': 'application/json' },
  body: JSON.stringify({"dlr_url":"https://example.mw/sms/dlr","mo_url":"https://example.mw/sms/inbound","campaign_url":"https://example.mw/sms/campaign"}),
});
console.log(resp.status, await resp.text());
import os
import requests

resp = requests.put(
    "https://api.sms.jtnoble.com/v1/webhooks",
    headers={"Authorization": f"Bearer {os.environ['JTSMS_API_KEY']}"},
    json={"dlr_url":"https://example.mw/sms/dlr","mo_url":"https://example.mw/sms/inbound","campaign_url":"https://example.mw/sms/campaign"},
    timeout=30,
)
print(resp.status_code, resp.text)
<?php
$ch = curl_init('https://api.sms.jtnoble.com/v1/webhooks');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => 'PUT',
    CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('JTSMS_API_KEY'), 'Content-Type: application/json'],
    CURLOPT_POSTFIELDS => '{"dlr_url":"https://example.mw/sms/dlr","mo_url":"https://example.mw/sms/inbound","campaign_url":"https://example.mw/sms/campaign"}',
]);
$body = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_RESPONSE_CODE), ' ', $body, PHP_EOL;

HTTP 200:

{
  "status": "updated"
}
HTTPcodeMessage
400invalid_webhook_urlThe webhook URL must be public and reachable.
401unauthorizedNot authenticated
403insufficient_scopeThis API key is not authorised for this action.
422validation_errorRequest validation failed
429rate_limitedToo many requests. Try again in a moment.

Make a new signing secret

POST /v1/webhooks/rotate-secret

Who can call it: API key with the webhooks scope, or a dashboard session token.

curl -X POST "https://api.sms.jtnoble.com/v1/webhooks/rotate-secret" \
  -H "Authorization: Bearer $JTSMS_API_KEY"
const resp = await fetch('https://api.sms.jtnoble.com/v1/webhooks/rotate-secret', {
  method: 'POST',
  headers: { Authorization: `Bearer ${process.env.JTSMS_API_KEY}` },
});
console.log(resp.status, await resp.text());
import os
import requests

resp = requests.post(
    "https://api.sms.jtnoble.com/v1/webhooks/rotate-secret",
    headers={"Authorization": f"Bearer {os.environ['JTSMS_API_KEY']}"},
    timeout=30,
)
print(resp.status_code, resp.text)
<?php
$ch = curl_init('https://api.sms.jtnoble.com/v1/webhooks/rotate-secret');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('JTSMS_API_KEY')],
]);
$body = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_RESPONSE_CODE), ' ', $body, PHP_EOL;

HTTP 200:

{
  "signing_secret": "whsec_YOUR_SECRET"
}
HTTPcodeMessage
401unauthorizedNot authenticated
403insufficient_scopeThis API key is not authorised for this action.
404not_foundWebhook config not found
429rate_limitedToo many requests. Try again in a moment.

Send test events

POST /v1/webhooks/test

Send sample HMAC-signed DLR + MO events to the configured endpoints so users can verify their integration.

Who can call it: API key with the webhooks scope, or a dashboard session token.

curl -X POST "https://api.sms.jtnoble.com/v1/webhooks/test" \
  -H "Authorization: Bearer $JTSMS_API_KEY"
const resp = await fetch('https://api.sms.jtnoble.com/v1/webhooks/test', {
  method: 'POST',
  headers: { Authorization: `Bearer ${process.env.JTSMS_API_KEY}` },
});
console.log(resp.status, await resp.text());
import os
import requests

resp = requests.post(
    "https://api.sms.jtnoble.com/v1/webhooks/test",
    headers={"Authorization": f"Bearer {os.environ['JTSMS_API_KEY']}"},
    timeout=30,
)
print(resp.status_code, resp.text)
<?php
$ch = curl_init('https://api.sms.jtnoble.com/v1/webhooks/test');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('JTSMS_API_KEY')],
]);
$body = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_RESPONSE_CODE), ' ', $body, PHP_EOL;

HTTP 200:

{
  "dlr": {
    "ok": true,
    "status": 200
  },
  "mo": {
    "ok": true,
    "status": 200
  }
}
HTTPcodeMessage
400bad_requestNo webhook endpoints configured. Add a DLR or MO URL first.
401unauthorizedNot authenticated
403insufficient_scopeThis API key is not authorised for this action.
429rate_limitedToo many requests. Try again in a moment.

On this page