Overview
Skip the poll loop. Subscribe to webhooks and Amps delivers action lifecycle events to your endpoint as they happen. Two events fire:push.completed and push.failed. Both arrive only when an action reaches a terminal state, typically within 10 seconds in live (3 minutes in sandbox).
Every delivery is signed with an HMAC-SHA256 signature, retried with exponential backoff on non-2xx, and stamped with an event ID delivered in the svix-id header for idempotency.
Step 1: Register the endpoint
Add the webhook URL in the Amps AI Dashboard under Webhooks settings. Pick the events to subscribe to (push.completed, push.failed) and copy the webhook secret. Store it in an environment variable; never commit it.
Step 2: Receive a push.completed payload
When a battery action completes, you receive a POST with this body. The event type and event ID are delivered in thesvix-id, svix-timestamp, and svix-signature headers, not the body:
command, the constraints-only parameters, and the clean deviceType. A push.failed payload mirrors the same shape and adds errorCode and errorMessage; result carries the connector’s error envelope, exactly as GET /actions/{actionId} returns it for a failed action:
Step 3: Verify the signature
Every delivery includes three headers (svix-id, svix-timestamp, svix-signature). Verify the signature before trusting the body; the SDK reads all three. The signature is HMAC-SHA256 of {id}.{timestamp}.{rawBody} keyed by your webhook secret.
- Node
- Python
- curl (replay test)
Step 4: Make the endpoint idempotent
Webhooks are at-least-once. Retries fire on any non-2xx response, a timeout (>30s), or a transient network failure. Use thesvix-id header as the idempotency key and persist seen IDs alongside the work the webhook triggers.
Retry behaviour
| Condition | Effect |
|---|---|
| Endpoint returns 2xx within 30 seconds | Delivery succeeds, no retry. |
| Endpoint returns non-2xx or times out | Retried with exponential backoff. |
| Repeated failures | Backed off and surfaced in the dashboard delivery log. |
200 OK as soon as the signature verifies and the event is recorded. Push business logic (email, dashboard updates) to async workers so the response stays inside the 30-second window.
What next
Webhook security details
Manual signature verification, timestamp checks, secret rotation.
Webhook event types
Full payload reference for every webhook event.
Schedule a charge for later
A scheduled action that fires push.completed when the window closes.
Handle conflicts
push.failed events surface SCHEDULER_ACTIVE and other conflict codes.