Overview
This recipe shows you how to set up a webhook endpoint that receives card events from Aptly, verifies the request is genuine, and processes the payload.What you need
- A publicly accessible URL for your server (use a tool like ngrok for local development)
- Your webhook signing key from Card Sources > API
- Node.js with a web framework such as Express
Step 1: Configure the webhook in Aptly
- Open the board in Aptly
- Click Card Sources > API
- Paste your server URL into the Webhook URL field
- Copy the Webhook Signing Key
Step 2: Create your endpoint
Set up a POST endpoint to receive incoming webhook requests from Aptly.Step 3: Handle the payload
The webhook payload contains the full card data as key/value pairs matching your board’s field structure.Step 4: Test your endpoint locally
Use ngrok to expose your local server to the internet during development.https://abc123.ngrok.io) and paste it as your Webhook URL in Aptly. Then trigger an update on a card and watch your server logs.
Things to watch out for
- Always return
200as quickly as possible. Aptly waits up to 60 seconds for a response before considering the delivery failed. - If your endpoint does not return
200, Aptly will retry the request indefinitely. If you need to take your server offline, update the Webhook URL in Card Sources to a temporary endpoint that returns200. - The signing key is a plain string match, not an HMAC signature. Keep it in an environment variable and never commit it to source control.
Next steps
- Update a card from within your webhook handler to write data back to Aptly
- Get data from a board to backfill your local data store on startup
