The Overview introduced the model — a service POSTing signed JSON to a URL you publish. This page makes it real. We’ll go from “I have a Spectrum project” to “my server processed a real message” in about five minutes, using Bun + Hono on the server side and ngrok to expose your local machine to the internet so you can test before deploying. If you already have a deployed HTTPS URL, skip the ngrok step.Documentation Index
Fetch the complete documentation index at: https://docs.photon.codes/docs/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
- A Spectrum project with at least one platform enabled. See Providers for the current list, or Getting Started with Spectrum if you don’t have a project yet.
- Your project id and project secret, from the dashboard or
photon projects show. - A reachable HTTPS URL — ngrok works for local development.
Stand up a local endpoint
Create In another terminal, expose port 3000:Copy the
server.ts. We’ll fill in the verification logic in the next step.server.ts
https://...ngrok-free.app URL it prints. That’s your webhook destination.Register the URL
Use The response contains the Export the secret so the server can use it:
curl (or any HTTP client) to register the URL with your project credentials:signingSecret — save it now. This is the only time you will ever see it.Add signature verification
Replace Three things to notice:
server.ts with a version that verifies the signature before processing the body:server.ts
- We read the body as raw text (
c.req.text()), not parsed JSON. The signature is computed over the exact bytes that arrived; any reformatting breaks verification. - We reject timestamps older than 5 minutes for replay protection.
- We compare with
timingSafeEqualto avoid leaking information about the secret through response timing.
Send a real message
Send a real message to your project from any of its enabled platforms — an iMessage to the assigned number, a WhatsApp message, whatever you’ve configured. Within a second or two, your terminal should print:If you see
bad signature, double-check that you exported SPECTRUM_SIGNING_SECRET correctly and re-started the server.If you see missing headers, the request didn’t come from Spectrum — check your ngrok URL and that the registered webhookUrl matches.Reply from your handler (optional)
The webhook delivery only carries inbound messages — there is no public HTTP “send a message” endpoint today. To reply, run the Inside the webhook handler, acknowledge with An HTTP send-message API is on the roadmap; until then, the SDK is the supported path.
spectrum-ts SDK in a separate process (or alongside your handler) and call space.send(...) there. The webhook tells your service what arrived; the SDK is what puts a message back on the wire.A common split:2xx first (the worker treats a slow response as a timeout and retries) and enqueue the reply job:What you just built
You have an end-to-end pipeline:What’s next
You wired up one URL, one verifier, and one delivery. The next chapters of the guide expand each piece — what’s in the delivery, why the verifier looks the way it does, and what happens when things fail.Events
Open the envelope — every header and every field in the payload, with examples for each content type.
Verifying signatures
The why behind the verifier, plus copy-paste implementations for Node, Bun, Python, and Go.
Delivery and retries
What the worker does when your endpoint is slow, down, or returns an unexpected status code.
Managing webhooks
List, delete, and rotate signing secrets via the API — full schemas in the API reference.