Skip to main content
EXAMPLE

HTTP Webhooks

This example demonstrates the http workflow step type, which performs an HTTP request with a configurable method/verb, query-string parameters, headers, and a request body (raw or form/JSON).…

HooksAutomation
cloudposse / atmos

Try it out

Copy the example into a new directory and make it your own:

atmos init examples/http-webhooks
cd http-webhooks

Follow the README for prerequisites and next steps.

See it in action

RECORDED DEMO
http-webhooks
 
Recorded from this example
Real commands. Real output.
README.md2.6 KB
View on GitHub

HTTP Step Type

This example demonstrates the http workflow step type, which performs an HTTP request with a configurable method/verb, query-string parameters, headers, and a request body (raw or form/JSON). Requests get per-attempt timeouts and retries that compose with the step's retry: policy.

webhook is an accepted alias for http — type: webhook behaves identically and is handy for the fire-a-notification use case.

Workflows

  • notify — POSTs a JSON payload to WEBHOOK_URL, retrying transient failures (5xx, 429, network errors) with exponential backoff, then prints the status code.
  • poll-health — GETs HEALTH_URL and retries until the response body matches a "healthy" pattern.

Run It

Point the workflows at any reachable endpoint via environment variables:

# Notify an endpoint (use your own URL, or a request-bin style service).
WEBHOOK_URL=https://example.com/hook atmos workflow notify -f http

# Poll a health endpoint until it reports healthy.
HEALTH_URL=https://example.com/healthz atmos workflow poll-health -f http

Key Fields

FieldDescription
urlRequest URL (required, supports templates).
methodHTTP verb: GET (default), POST, PUT, PATCH, DELETE, HEAD, OPTIONS.
queryQuery-string parameters.
headersRequest headers.
body / formRaw body, or key-value params (urlencoded, or JSON when Content-Type is JSON). Mutually exclusive.
expect.statusAcceptable status codes (default: any 2xx).
expect.responseRegexes the response body must match (at least one).
timeoutPer-attempt timeout (default 30s).
retryRetry policy; transport errors / 5xx / 429 retry by default.

The response is available to later steps as {{ .steps.<name>.value }} (body) and {{ .steps.<name>.metadata.status_code }}.