Skip to main content
Command reference

codespar triggers

Webhook endpoints: deliveries, DLQ, secret rotation, redelivery

4 min read
View MarkdownEdit on GitHub

Webhook endpoints: deliveries, DLQ, secret rotation, redelivery

12 commands in @codespar/cli 0.16.0.

Each one prints what its operation answered. What a command prints has the rule, and Configuration has the exit codes and the shape of a failure.

codespar triggers list

List triggers

codespar triggers list
optionwhat it does
-q, --query <key=value>Query parameter (repeatable) (default: [])
--timeout <ms>Per-request timeout in milliseconds

GET /v1/webhook-endpoints · parameters, responses and refusals

codespar triggers create

Subscribe a webhook to an event

codespar triggers create --input-file body.json
body.json
{
  "name": "Example",
  "event": "string",
  "server_id": "srv_0000000000000000",
  "webhook_url": "https://example.com/hook",
  "condition": {
    "all": [
      {
        "field": "amount_minor",
        "op": "gt",
        "value": 1000
      }
    ]
  },
  "action": {
    "kind": "webhook"
  }
}
optionwhat it does
-q, --query <key=value>Query parameter (repeatable) (default: [])
--timeout <ms>Per-request timeout in milliseconds
-i, --input <json>Request body as a JSON string
-f, --input-file <path>Request body from a JSON file

POST /v1/webhook-endpoints · parameters, responses and refusals

codespar triggers get

Read one webhook endpoint

codespar triggers get obj_0000000000000000
argumentwhat it is
<id>Endpoint id, trg_ followed by a 16 character nanoid, as minted by the create call.
optionwhat it does
-q, --query <key=value>Query parameter (repeatable) (default: [])
--timeout <ms>Per-request timeout in milliseconds

GET /v1/webhook-endpoints/{id} · parameters, responses and refusals

codespar triggers delete

Delete a webhook endpoint

codespar triggers delete obj_0000000000000000
argumentwhat it is
<id>Endpoint id, trg_ followed by a 16 character nanoid, as minted by the create call.
optionwhat it does
-q, --query <key=value>Query parameter (repeatable) (default: [])
--timeout <ms>Per-request timeout in milliseconds

DELETE /v1/webhook-endpoints/{id} · parameters, responses and refusals

codespar triggers update

Update a webhook endpoint

codespar triggers update obj_0000000000000000 --input-file body.json
body.json
{
  "name": "Example",
  "webhook_url": "https://example.com/hook",
  "status": "active",
  "condition": {
    "all": [
      {
        "field": "amount_minor",
        "op": "gt",
        "value": 1000
      }
    ]
  },
  "action": {
    "kind": "webhook"
  }
}
argumentwhat it is
<id>Endpoint id, trg_ followed by a 16 character nanoid, as minted by the create call.
optionwhat it does
-q, --query <key=value>Query parameter (repeatable) (default: [])
--timeout <ms>Per-request timeout in milliseconds
-i, --input <json>Request body as a JSON string
-f, --input-file <path>Request body from a JSON file

PATCH /v1/webhook-endpoints/{id} · parameters, responses and refusals

codespar triggers test-fire

Deliver a synthetic event to a webhook endpoint

codespar triggers test-fire obj_0000000000000000 --input '{"event_type":"string","payload":{}}'
argumentwhat it is
<id>Endpoint id, trg_ followed by a 16 character nanoid, as minted by the create call.
optionwhat it does
-q, --query <key=value>Query parameter (repeatable) (default: [])
--timeout <ms>Per-request timeout in milliseconds
-i, --input <json>Request body as a JSON string
-f, --input-file <path>Request body from a JSON file

POST /v1/webhook-endpoints/{id}/test-fire · parameters, responses and refusals

codespar triggers rotate-secret

Mint a new signing secret for a webhook endpoint

codespar triggers rotate-secret obj_0000000000000000
argumentwhat it is
<id>Endpoint id, trg_ followed by a 16 character nanoid, as minted by the create call.
optionwhat it does
-q, --query <key=value>Query parameter (repeatable) (default: [])
--timeout <ms>Per-request timeout in milliseconds

POST /v1/webhook-endpoints/{id}/rotate-secret · parameters, responses and refusals

codespar triggers list-deliveries

List recent delivery attempts

codespar triggers list-deliveries obj_0000000000000000
argumentwhat it is
<id>Endpoint id, trg_ followed by a 16 character nanoid, as minted by the create call.
optionwhat it does
-q, --query <key=value>Query parameter (repeatable) (default: [])
--timeout <ms>Per-request timeout in milliseconds

GET /v1/webhook-endpoints/{id}/deliveries · parameters, responses and refusals

codespar triggers get-deliveries

Inspect one delivery attempt

codespar triggers get-deliveries obj_0000000000000000 delivery_0000000000000000
argumentwhat it is
<id>Endpoint id, trg_ followed by a 16 character nanoid, as minted by the create call.
<delivery_id>Delivery id as decimal digits, the string form of the bigserial column. Up to 19 digits, which is the width of a signed 64 bit maximum; anything else is refused with 400 invalid_delivery_id before the database is touched.
optionwhat it does
-q, --query <key=value>Query parameter (repeatable) (default: [])
--timeout <ms>Per-request timeout in milliseconds

GET /v1/webhook-endpoints/{id}/deliveries/{delivery_id} · parameters, responses and refusals

codespar triggers dlq

List dead lettered deliveries

codespar triggers dlq obj_0000000000000000
argumentwhat it is
<id>Endpoint id, trg_ followed by a 16 character nanoid, as minted by the create call.
optionwhat it does
-q, --query <key=value>Query parameter (repeatable) (default: [])
--timeout <ms>Per-request timeout in milliseconds

GET /v1/webhook-endpoints/{id}/dlq · parameters, responses and refusals

codespar triggers retry-pending

Drain the retry queue for this project

codespar triggers retry-pending
optionwhat it does
-q, --query <key=value>Query parameter (repeatable) (default: [])
--timeout <ms>Per-request timeout in milliseconds

POST /v1/webhook-endpoints/retry-pending · parameters, responses and refusals

codespar triggers deliveries-redeliver

Queue a delivery to be sent again

codespar triggers deliveries-redeliver delivery_0000000000000000
argumentwhat it is
<delivery_id>Delivery id as decimal digits, the string form of the bigserial column. Up to 19 digits, which is the width of a signed 64 bit maximum; anything else is refused with 400 invalid_delivery_id before the database is touched.
optionwhat it does
-q, --query <key=value>Query parameter (repeatable) (default: [])
--timeout <ms>Per-request timeout in milliseconds

POST /v1/webhook-endpoints/deliveries/{delivery_id}/redeliver · parameters, responses and refusals

codespar triggers | CodeSpar