agentleFS
thunderphonethunderphone/skills/setup-webhooks/SKILL.md

setup-webhooks

Skill0 starsChanged 57 days agoMITView on GitHub

Create, test, verify, rotate, or troubleshoot ThunderPhone webhook endpoints. Use when someone asks for call events, incoming or complete notifications, webhook signing secrets, X-ThunderPhone-Signature verification, HMAC code in Python or TypeScript, retries, or duplicate delivery handling.

  • Reads credentials

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use webhook endpoints, events, and signature verification.

    line 84
  2. Distinctive:

    Never log the endpoint signing secret, authorization header, or unredacted sensitive payload.

    line 85

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Set up signed webhooks

  1. Choose events. Subscribe only to required event families. Common choices include telephony.incoming, telephony.complete, tool and turn events, web.*, voice.*, call.graded, issue.reported, test-call.completed, and alert.triggered. Confirm exact values in the events reference.
  2. Create an HTTPS receiver. Preserve the exact raw request bytes. Parse JSON only after signature verification. Return a fast success and queue slower work.
  3. Create the endpoint with POST /v1/developer/webhook-endpoints. Capture the signing secret once into a secret manager; the create response does not make it safe to log.
{
  "label": "Production call events",
  "url": "https://example.com/thunderphone/hook",
  "events": ["telephony.incoming", "telephony.complete"]
}
curl --fail-with-body -X POST https://api.thunderphone.com/v1/developer/webhook-endpoints \
  -H "Authorization: Bearer $THUNDERPHONE_API_KEY" \
  -H "Content-Type: application/json" \
  -H "X-ThunderPhone-Client: skills/setup-webhooks@1.0" \
  --data-binary @webhook-endpoint.json
  1. Verify every delivery. Compute HMAC-SHA256 over the raw bytes and compare it with X-ThunderPhone-Signature in constant time.
import hashlib, hmac, os

def verify_thunderphone(raw_body: bytes, signature: str) -> bool:
    expected = hmac.new(os.environ["THUNDERPHONE_WEBHOOK_SECRET"].encode(),
                        raw_body, hashlib.sha256).hexdigest()
    return hmac.compare_digest(expected, signature)
import { createHmac, timingSafeEqual } from "node:crypto";

export function verifyThunderPhone(rawBody: Buffer, signature: string): boolean {
  const expected = createHmac("sha256", process.env.THUNDERPHONE_WEBHOOK_SECRET!)
    .update(rawBody).digest("hex");
  const received = Buffer.from(signature, "utf8");
  const wanted = Buffer.from(expected, "utf8");
  return received.length === wanted.length && timingSafeEqual(received, wanted);
}
  1. Make processing idempotent. Deduplicate with the delivery/event ID. Store the event before performing side effects. Accept retries without repeating external writes.
  2. Test the endpoint using POST /v1/developer/webhook-endpoints/{endpoint_id}/test, then trigger one real controlled event.
  3. Verify. Confirm valid events pass, a changed byte or signature fails, the receiver returns quickly, and retrying the same event creates one effect.

Errors

SymptomCauseFix
Every signature failsJSON was parsed/reserialized before hashing or wrong secret is loadedHash raw bytes and confirm the endpoint-specific secret.
Valid request crashes timing-safe compareEncodings or lengths differDecode consistently and reject unequal lengths before comparison.
Duplicate side effectsDelivery was treated as exactly-oncePersist a delivery key and make consumers idempotent.
Test passes but real events do notWrong event selection or environment endpointRead the endpoint record and trigger the exact subscribed event.

Source and safety rules

  • Use webhook endpoints, events, and signature verification.
  • Never log the endpoint signing secret, authorization header, or unredacted sensitive payload.
  • Reject before parsing or acting when signature verification fails.
  • A test delivery proves reachability, not every production event path.

See references/webhook-checklist.md.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.