Skip to main content
  • For: anyone building a tool that several groups connect to, such as a district volunteer’s dashboard or a booking system
  • You get: an endpoint your tool adds to each group itself, tested, with its signing secret stored
  • Time: about twenty minutes
  • Scopes: webhooks:read, webhooks:write, and the read scope of each event you want, such as members:read for member.created
When a group connects your tool, it gives you an API key. Without this recipe, a group admin then also has to open Settings → Integrations → Webhooks, paste your address and tick the right events. With webhooks:write on the key, your tool does that itself, the same way for every group.
There is no dry run, and the sandbox key cannot change anything. Use your own key, and try each step first on a test address of your own, such as a webhook.site URL, before you point it at your real receiver.

1. Ask for the right scopes

Tell each group admin which scopes to tick when they create the key for your tool:
  • webhooks:read and webhooks:write, to manage the endpoint;
  • the read scope of every event you want. An endpoint can receive only events whose records the key can read: member.created needs members:read, event.updated needs events:read. The event list gives each one’s scope. Payment events cannot be chosen with a key: an admin adds those in Scoutworks.
Check what a key can do with GET /me before you go on:

2. Look for an endpoint you added before

A group may connect your tool twice, or reconnect it. List its endpoints first, and reuse yours if it is there:
Match on your own address. A group holds at most ten endpoints, so a tool should never add a second one of its own. Your key sees only endpoints whose every event it can read: one an admin set up for payment events, say, is left out, and answers 404.

3. Add the endpoint

The answer carries the endpoint and its signing secret, which starts whsec_. Store the secret now, against the group, in your tool’s secret store: it is never shown again. If the request times out, send it again with the same Idempotency-Key: you get the same endpoint, without the secret, and no second endpoint is made. Then rotate the secret (step 5) to get one you can store. Put the group’s id in the address, as above, so your receiver knows which group’s secret checks each message.

4. Check it works

Send a test event:
A webhook.test message reaches your receiver within a few seconds. Check its signature with the secret you stored. Then read the delivery to see what your receiver answered:
A status of delivered means it worked. failed, or a lastHttpStatus other than 2xx, means your receiver refused it: the attempts show what it answered.

5. Rotate the secret

Rotate each group’s secret on a schedule, and at once if you think one has leaked:
The answer carries the new secret. Store it. The old secret keeps signing beside the new one for 24 hours, and each message carries both signatures, so your receiver can switch over without missing a message.

6. Look after it

  • It stops working with the key’s creator. An endpoint added with a key belongs to the admin who created the key. If they stop being a group admin, the endpoint stops sending (status: owner_inactive), as the key stops working. Ask the group for a new key, delete the old endpoint and add it again.
  • A failing endpoint is switched off after five days of failed tries (status: disabled, disabledReason: failing). Fix your receiver, then switch it back on:
  • When a group disconnects your tool, delete your endpoint with DELETE /webhook-endpoints/{endpointId}.
  • Catch anything you missed. A message can go astray. Run Keep a copy in sync now and then: GET /changes reports every change, webhook or not.

Switch to your group

Every write here goes to api.scoutworks.app with the group’s own key, which needs the scopes in step 1. Scoutworks records each change as made by the admin who created the key, and marks it with the key’s name, so the group can see in its webhook settings what your tool did. Webhooks cannot be added in the demo.

If something goes wrong

  • 403 insufficient_scope on add or change: the key lacks webhooks:write, or the read scope of one of the events. The message names the events.
  • 400 invalid_request: the address must start https:// and use a public domain name, not an IP address.
  • 409 conflict on add: the group already has ten endpoints. On a test: the endpoint is switched off.
  • 412 stale_write: someone changed the endpoint since you read it. Read it again, then retry with its new ETag.
See Errors for every code.