Skip to content

Create Webhook POST

Create a new webhook to receive notifications from external services.

Endpoint

POST https://api.pocketalert.app/v1/webhooks

Authentication

Required

Include one of these headers in your request:

  • Token: <your-api-key> — Get it from API Keys
  • Authorization: Bearer <jwt-token> — From Login

Request

Headers

HeaderRequiredDescription
TokenYour API key
AuthorizationBearer <jwt-token>

Body Parameters

ParameterTypeRequiredDescription
namestringWebhook name (e.g., "Sentry", "GitHub")
messagestringMessage template (use * for raw JSON)
application_idstringApplication TID to categorize messages
device_idstringTarget device TID (omit for all devices)

Message Template Syntax

Use %field.path% to extract values from incoming JSON:

TemplateDescription
*Output entire JSON payload
%field%Extract top-level field
%object.field%Extract nested field
%array.0.field%Extract from array by index

See Webhook Settings for detailed examples.

Example Request

bash
curl -X POST "https://api.pocketalert.app/v1/webhooks" \
  -H "Token: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "GitHub Push",
    "message": "Push to %repository.name%: %head_commit.message%",
    "application_id": "s9h1ekk5xb46jikthl"
  }'
javascript
const response = await fetch('https://api.pocketalert.app/v1/webhooks', {
  method: 'POST',
  headers: {
    'Token': 'your-api-key',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    name: 'GitHub Push',
    message: 'Push to %repository.name%: %head_commit.message%',
    application_id: 's9h1ekk5xb46jikthl'
  })
});

const webhook = await response.json();
console.log('Webhook URL:', `https://api.pocketalert.app/v1/webhooks/receive/${webhook.url}`);
python
import requests

response = requests.post(
    'https://api.pocketalert.app/v1/webhooks',
    headers={'Token': 'your-api-key'},
    json={
        'name': 'GitHub Push',
        'message': 'Push to %repository.name%: %head_commit.message%',
        'application_id': 's9h1ekk5xb46jikthl'
    }
)

webhook = response.json()
print(f"Webhook URL: https://api.pocketalert.app/v1/webhooks/receive/{webhook['url']}")
php
$response = Http::withHeaders([
    'Token' => 'your-api-key',
])->post('https://api.pocketalert.app/v1/webhooks', [
    'name' => 'GitHub Push',
    'message' => 'Push to %repository.name%: %head_commit.message%',
    'application_id' => 's9h1ekk5xb46jikthl',
]);

$webhook = $response->json();
echo 'Webhook URL: https://api.pocketalert.app/v1/webhooks/receive/'.$webhook['url'];

Response

Success Response

201 Created

Webhook created successfully

FieldTypeDescription
tidstringUnique webhook identifier
namestringWebhook name
urlstringWebhook URL slug — use this in external services
messagestringMessage template
is_activebooleanWhether webhook is active
json
{
  "tid": "kblf7mh9j8jjyeh4fx",
  "name": "GitHub Push",
  "url": "cs994rqfkk8ljngt",
  "message": "Push to %repository.name%: %head_commit.message%",
  "application_tid": "qm47b9pzxzx7applfd0",
  "device_tid": "",
  "is_active": true,
  "created_at": "01.09.2023 22:38:48"
}

Using Your Webhook

Configure your external service to POST to:

https://api.pocketalert.app/v1/webhooks/receive/{url}

Error Responses

StatusDescription
401Unauthorized — Invalid or missing token
422Validation Error — Missing required fields

Pocket Alert Documentation