Package: webhooks
Generated from api/packages/webhooks
Source: api/packages/webhooks. The sections after the README are extracted from the code on every docs build.
README
Section titled “README”Lets an academy (tenant) register https URLs that receive its domain events as signed, versioned JSON:
HMAC-SHA256 signature with a timestamp (replay resistant), retries with exponential backoff through the
queue, a delivery log with every attempt, test sends, replays and SSRF-safe target URLs. Phase 7.3 of
docs/ROADMAP-PROMPT.md.
- Guide for receivers and admins:
front/docs-site/src/content/docs/developers/outgoing-webhooks.mdx - Endpoints:
api/admin/webhooks/*(permissionwebhook_manage, token scopewebhooks:read|write), documented in OpenAPI under the tag “Admin Webhooks”. - Events wired today:
course.completed,enrolment.created,update_proposal.ready,update_proposal.applied,certificate.issued,course.version_applied,knowledge.exported,training.assigned,training.completed,training.overdue,path.completed,certificate.revoked,policy.change.approved,policy.retraining.assigned. Planned types are listed byGET /api/admin/webhooks/events.
domain event ─▶ EventCatalog (class → type, payload) ─▶ WebhookDispatcher ─▶ one WebhookDelivery per enabled, subscribed endpoint (payload stored as sent) ─▶ DeliverWebhookJob ─▶ DeliveryRunner ─▶ Ulams\Core\Http\SafeHttp (https, public IPs, pinned address, no redirects) ─▶ 2xx: succeeded | else: attempt logged, retry with backoff, after max attempts failed, endpoint disabled after N failed deliveries in a rowInstall
Section titled “Install”Registered in api/config/app.php. Then:
php artisan migratephp artisan db:seed --class="Ulams\Webhooks\Database\Seeders\WebhookPermissionSeeder"php artisan vendor:publish --tag=ulams_webhooks.config # optionalA queue worker must run for deliveries; the scheduler runs webhooks:retry-due every minute (retries
whose job was lost, and every retry under the synchronous queue) and webhooks:prune daily.
Configuration
Section titled “Configuration”src/config.php: api_version, max_endpoints, max_attempts, backoff_seconds, timeout,
disable_after_failures, retention_days, rate limits. Environment: WEBHOOKS_ALLOW_INSECURE (local
development only: http and private addresses), WEBHOOKS_ALLOWED_HOSTS, WEBHOOKS_QUEUE,
WEBHOOKS_QUEUE_CONNECTION.
Adding an event
Section titled “Adding an event”Add it to Support/EventCatalog.php (class name as a string, description, payload builder, sample) and
to the table in the guide. tests/Feature/DomainEventsTest.php fails when an available type has no
listener.
vendor/bin/phpunit --testsuite webhooksThe receiver is a Guzzle MockHandler bound as webhooks.http_handler; DNS is replaced through
SafeHttp::useResolver, so no test touches the network.
API endpoints
Section titled “API endpoints”| Method | Path | Auth | Action |
|---|---|---|---|
GET |
/api/admin/webhooks/events |
yes | WebhooksController@events |
GET |
/api/admin/webhooks/endpoints |
yes | WebhooksController@index |
POST |
/api/admin/webhooks/endpoints |
yes | WebhooksController@store |
GET |
/api/admin/webhooks/endpoints/{endpoint} |
yes | WebhooksController@show |
PUT |
/api/admin/webhooks/endpoints/{endpoint} |
yes | WebhooksController@update |
DELETE |
/api/admin/webhooks/endpoints/{endpoint} |
yes | WebhooksController@destroy |
POST |
/api/admin/webhooks/endpoints/{endpoint}/rotate-secret |
yes | WebhooksController@rotateSecret |
POST |
/api/admin/webhooks/endpoints/{endpoint}/test |
yes | WebhooksController@test |
GET |
/api/admin/webhooks/deliveries |
yes | WebhooksController@deliveries |
GET |
/api/admin/webhooks/deliveries/{delivery} |
yes | WebhooksController@showDelivery |
POST |
/api/admin/webhooks/deliveries/{delivery}/replay |
yes | WebhooksController@replay |
Permissions
Section titled “Permissions”| Permission | Seeded for roles | Constant |
|---|---|---|
webhook_manage |
admin | WebhookPermissionEnum::WEBHOOK_MANAGE |
Settings
Section titled “Settings”Registered with AdministrableConfig::registerConfig (editable in the admin panel under Configuration → Settings).
None.
Events
Section titled “Events”None.
Artisan commands
Section titled “Artisan commands”| Command | Description | Signature |
|---|---|---|
webhooks:prune |
Delete webhook deliveries (and their attempts) older than the retention period | webhooks:prune |
webhooks:retry-due |
Queue webhook retries that are overdue (a lost job, or the synchronous queue) | webhooks:retry-due {--grace= : Seconds a retry may be overdue before it is queued again} |
Scheduled jobs
Section titled “Scheduled jobs”| Kind | Target | Frequency |
|---|---|---|
| command | 'webhooks:retry-due' |
everyMinute()->withoutOverlapping() |
| command | 'webhooks:prune' |
daily() |
Environment variables read
Section titled “Environment variables read”WEBHOOKS_ALLOW_INSECURE, WEBHOOKS_ALLOWED_HOSTS, WEBHOOKS_QUEUE, WEBHOOKS_QUEUE_CONNECTION