Skip to content
This repository was archived by the owner on Nov 30, 2026. It is now read-only.

Add webhook-endpoint commands - #315

Closed
joetannenbaum wants to merge 1 commit into
mainfrom
api-sync/webhook-endpoints
Closed

joetannenbaum wants to merge 1 commit into
mainfrom
api-sync/webhook-endpoints

Conversation

@joetannenbaum

@joetannenbaum joetannenbaum commented Nov 30, 2026 •

Copy link
Copy Markdown
Collaborator

Adds webhook-endpoint:* commands for the webhook endpoints the live Cloud API spec now documents. Cloud sends a signed POST to an endpoint for each deployment event it subscribes to.

Findings

Endpoint Spec CLI before
GET /environments/{environment}/webhook-endpoints Lists an environment's endpoints (paginated). The signing secret is never included. No request class or command
POST /environments/{environment}/webhook-endpoints Body url (required, HTTPS, max 2048), events (required, at least one of deployment.live, deployment.succeeded, deployment.failed, deployment.post_deploy_failed), enabled (default true). Answers 201 with the endpoint including its signing secret, which is returned only here and on rotation. Up to 5 per environment. No request class or command
GET /webhook-endpoints/{webhookEndpoint} One endpoint, without its secret. No request class or command
PATCH /webhook-endpoints/{webhookEndpoint} url, events, enabled, all optional. No request class or command
DELETE /webhook-endpoints/{webhookEndpoint} 204; Cloud stops sending events. No request class or command
POST /webhook-endpoints/{webhookEndpoint}/test Sends a ping right away (not retried) and answers 201 with the WebhookDeliveryResource. No request class or command
GET /webhook-endpoints/{webhookEndpoint}/deliveries The last 50 delivery attempts, newest first, with full request and response. No request class or command
POST /webhook-endpoints/{webhookEndpoint}/secret Generates a new signing secret; the old one stops working immediately. The new secret is only in this response. No request class or command

Changes

  • Request classes in app/Client/Resources/WebhookEndpoints/, payloads CreateWebhookEndpointRequestData / UpdateWebhookEndpointRequestData, WebhookEndpointsResource, DTOs WebhookEndpoint and WebhookDelivery, enums WebhookEventType and WebhookDeliveryOutcome.
  • WebhookEndpointResolver: an argument containing :// is matched against the environment's endpoint URLs; anything else is fetched by ID, and only a 404 falls back to URL matching. The spec doesn't document an ID prefix, so none is assumed. With no argument it picks from the environment's endpoints.
  • Commands:
    • webhook-endpoint:list {environment?} — table of ID, URL, events, enabled, last delivery and outcome; Enter opens webhook-endpoint:get.
    • webhook-endpoint:get {webhook-endpoint?}
    • webhook-endpoint:create {environment?} --url= --events=* --disabled — prompts for the URL, then a multiselect of the four deployment events. enabled: false is sent only with --disabled.
    • webhook-endpoint:update {webhook-endpoint?} --url= --events=* --enabled --disabled --force — the usual multi-field update: flags pick fields and confirm unless --force; with no flags a multiselect asks.
    • webhook-endpoint:delete {webhook-endpoint?} --force
    • webhook-endpoint:test {webhook-endpoint?} — shows event, outcome, status code, duration and error; exits 1 when the ping failed or was blocked, after printing the delivery JSON (as deploy does for a failed deployment).
    • webhook-endpoint:deliveries {webhook-endpoint?} — table; --json carries each delivery's request and response.
    • webhook-endpoint:rotate-secret {webhook-endpoint?} --force — confirms, since the current secret stops working right away.
  • Signing secret: like database-user:create's password, create and rotate-secret always show it to a person (with "Save this signing secret now. It will not be shown again."), since the API sends it only once. --json masks it unless --show-sensitive, and warns on stderr when it does.
  • README command table, app/Client/README.md and the deploying-to-cloud skill.
  • tests/Feature/WebhookEndpointCommandsTest.php: 33 tests asserting paths and bodies for every command, ID/URL resolution (including a 500 not being read as "not found"), secret masking, --force handling and the test exit code.

Full suite (except PromptFallbackTest, which hangs in the sandbox; CI runs it), RepoConfigTest, phpstan and pint all pass.

Worth a look

  • webhook-endpoint:test exiting 1 on a failed/blocked ping is a choice; easy to flip to 0.
  • --events isn't checked locally; an unknown event gets the API's 422.

Demo

cloud webhook-endpoint:create
webhook-endpoint:create: prompts for the URL, then the deployment events; shows the signing secret once.

cloud webhook-endpoint:list
webhook-endpoint:list: lists an environment's endpoints; Enter opens the details.

cloud webhook-endpoint:get
webhook-endpoint:get: picks an endpoint and shows its details.

cloud webhook-endpoint:update
webhook-endpoint:update: field picker, then just the chosen field (here, disabling the endpoint).

cloud webhook-endpoint:delete
webhook-endpoint:delete: confirms by URL, then deletes.

cloud webhook-endpoint:test
webhook-endpoint:test: sends a ping and shows the delivery's outcome.

cloud webhook-endpoint:deliveries
webhook-endpoint:deliveries: the endpoint's recent deliveries.

cloud webhook-endpoint:rotate-secret
webhook-endpoint:rotate-secret: confirms, then shows the new signing secret once.

https://claude.ai/code/session_01T1Sq4VFXLQeWRu5VVHBpAB


Generated by Claude Code

The API now lets an environment send signed deployment events to up to
five HTTPS endpoints. This adds the request classes, resource, DTOs,
enums and resolver for them, and eight commands:

- webhook-endpoint:list, :get
- webhook-endpoint:create, :update, :delete
- webhook-endpoint:test (sends a ping; exits non-zero when the delivery
  fails or is blocked)
- webhook-endpoint:deliveries (last 50, with request and response)
- webhook-endpoint:rotate-secret

Endpoint IDs have no documented prefix, so an endpoint argument is tried
as an ID (only a 404 falls through) and otherwise matched against the
URLs of the environment's endpoints. The signing secret is returned only
by create and rotate-secret: a person always sees it, and JSON masks it
unless --show-sensitive is passed, as database-user:create does with its
password. Rotating stops the old secret immediately, so it confirms (or
needs --force headless).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T1Sq4VFXLQeWRu5VVHBpAB
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants