This repository was archived by the owner on Nov 30, 2026. It is now read-only.
Repository navigation
Add webhook-endpoint commands - #315
Closed
joetannenbaum wants to merge 1 commit into
Closed
joetannenbaum wants to merge 1 commit into
joetannenbaum wants to merge 1 commit into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
webhook-endpoint:*commands for the webhook endpoints the live Cloud API spec now documents. Cloud sends a signedPOSTto an endpoint for each deployment event it subscribes to.Findings
GET /environments/{environment}/webhook-endpointsPOST /environments/{environment}/webhook-endpointsurl(required, HTTPS, max 2048),events(required, at least one ofdeployment.live,deployment.succeeded,deployment.failed,deployment.post_deploy_failed),enabled(defaulttrue). Answers 201 with the endpoint including its signing secret, which is returned only here and on rotation. Up to 5 per environment.GET /webhook-endpoints/{webhookEndpoint}PATCH /webhook-endpoints/{webhookEndpoint}url,events,enabled, all optional.DELETE /webhook-endpoints/{webhookEndpoint}POST /webhook-endpoints/{webhookEndpoint}/testpingright away (not retried) and answers 201 with theWebhookDeliveryResource.GET /webhook-endpoints/{webhookEndpoint}/deliveriesPOST /webhook-endpoints/{webhookEndpoint}/secretChanges
app/Client/Resources/WebhookEndpoints/, payloadsCreateWebhookEndpointRequestData/UpdateWebhookEndpointRequestData,WebhookEndpointsResource, DTOsWebhookEndpointandWebhookDelivery, enumsWebhookEventTypeandWebhookDeliveryOutcome.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.webhook-endpoint:list {environment?}— table of ID, URL, events, enabled, last delivery and outcome; Enter openswebhook-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: falseis 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?} --forcewebhook-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 (asdeploydoes for a failed deployment).webhook-endpoint:deliveries {webhook-endpoint?}— table;--jsoncarries each delivery's request and response.webhook-endpoint:rotate-secret {webhook-endpoint?} --force— confirms, since the current secret stops working right away.database-user:create's password,createandrotate-secretalways show it to a person (with "Save this signing secret now. It will not be shown again."), since the API sends it only once.--jsonmasks it unless--show-sensitive, and warns on stderr when it does.app/Client/README.mdand thedeploying-to-cloudskill.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,--forcehandling and thetestexit code.Full suite (except
PromptFallbackTest, which hangs in the sandbox; CI runs it),RepoConfigTest, phpstan and pint all pass.Worth a look
webhook-endpoint:testexiting 1 on a failed/blocked ping is a choice; easy to flip to 0.--eventsisn'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