A single API route, /api/chamade-webhook, performs HMAC signature verification on the raw request body
chamade-template-vercel-nextjs — Next.js Starter Template
By Nafis-Chamade
A Vercel starter template for a Chamade webhook handler, based on the Next.js 15 App Router, which verifies the HMAC signature in the /api/chamade-webhook route, hands dm.received events to Claude for processing, and posts replies back to Chamade.
Explore the design
Compare the page layouts and mobile experience. Open any screenshot for a closer look.
Actual browser screenshot from the verified demo.
All pages & views 2
Screenshots show visual appearance; interactive behavior may differ.
What stands out
A quick read of the recorded project description.
dm.received events are handed to Claude via the Anthropic SDK, then posted back to /api/reply/dm using reply_token
agent.timeout returns a default delayed apology message, while webhook.test and unknown events are only acknowledged
Environment variables include the required CHAMADE_WEBHOOK_SECRET and ANTHROPIC_API_KEY, plus the optional CHAMADE_BASE_URL and ANTHROPIC_MODEL
The README notes that idempotent deduplication defaults to an in-memory Set, and multi-region deployments need shared state such as KV/Redis
Template Details
This is a Vercel starter template for a Chamade webhook, using the Next.js 15 App Router. The README states that it contains only one API route, /api/chamade-webhook, which does three things: verify the HMAC signature on the raw request body, dispatch dm.received events to Claude (Anthropic SDK), and then POST the model reply back to Chamade via /api/reply/dm carrying the event's reply_token.
On event handling, the behaviors listed in the README are: dm.received sends event.data.text to Claude and posts a reply; agent.timeout replies asynchronously with a default delayed apology message; webhook.test is only acknowledged; other events are also only acknowledged, and route.ts must be extended to cover scenarios such as voice.
The deployment path is: first push the template to GitHub or another Git host, then import the project in Vercel and configure environment variables, then fill the stable alias URL (not a single deployment URL) into the channel webhook configuration in the Chamade dashboard, and finally verify with Send test in the dashboard. The README also gives a local development approach (npm run dev together with ngrok) and several caveats, including the Vercel function timeout limit, cold starts, signing key rotation, and multi-region idempotent state. The README does not provide information about a template UI, a database, or integrations other than Anthropic.
Is it right for your project?
Use Cases
- Connecting Claude auto-replies to Chamade direct message events
- Setting up and verifying the Chamade webhook signature verification chain on Vercel
- Debugging Chamade webhook delivery locally with npm run dev plus ngrok
- Extending the existing switch branches with new event types such as voice (call.transcript)
Suitable For
- Developers who need to get the Chamade webhook send/receive flow running quickly on Vercel
- Teams using the Next.js App Router that want Claude as the reply model
- Engineers prepared to replace the in-memory idempotency and conversation memory implementations themselves and connect KV or Redis
Getting started & customization
Use these recorded setup notes alongside the repository instructions for your chosen version.
- 1
Copy the template to a local repository and push it to GitHub or another Git host, then import that repository in Vercel
- 2
Configure CHAMADE_WEBHOOK_SECRET and ANTHROPIC_API_KEY in the Vercel project settings or via vercel env, and set CHAMADE_BASE_URL and ANTHROPIC_MODEL as needed
- 3
Fill the stable alias URL (for example https://<project-name>.vercel.app/api/chamade-webhook) into the channel webhook configuration in the Chamade dashboard; do not use a single deployment URL
- 4
Click Send test in the dashboard and confirm that HTTP 200 appears in the delivery logs
- 5
For local development, run npm install, copy .env.example to .env.local and fill in the keys, then run npm run dev; ngrok can be used to expose the port
License & source material
Usage conditions & limitations
Free to use · keep license noticeThis entry covers the free version under the MIT license in a public repository; the free scope is the code of that version and does not mean that external services or third-party assets are free.
Must comply with when using
- Free use, modification, commercial use, and distribution of this version's code are allowed.
- When distributing copies or substantial portions of the code, the original author's copyright notice and the complete MIT license notice must retain.
- The code is provided as is; warranties and limitations of liability are governed by the original license and applicable law.
Additional costs & items to verify
- Demo images, fonts, icons, and other third-party assets must be checked against their respective licenses and cannot be judged solely by the code's MIT license.
- External services such as domains, hosting, databases, payments, or AI may incur separate charges.
- The CHAMADE_WEBHOOK_SECRET environment variable must be set; this key is shown only once at /dashboard/keys after saving the webhook URL.
- The ANTHROPIC_API_KEY environment variable must be set and must be obtained from the Anthropic console.
- The optional environment variable CHAMADE_BASE_URL defaults to https://chamade.io and can be changed to https://dev.chamade.io to connect to the development environment.
- The optional environment variable ANTHROPIC_MODEL defaults to claude-sonnet-4-6.
- A stable alias URL must be used rather than a single deployment URL, otherwise Chamade will still hit the old function after environment variable rotation.
- Idempotent deduplication defaults to an in-memory Set keyed by event_id; multi-region Vercel deployments need shared state such as KV/Redis.
- Vercel function timeouts are limited: 60 seconds on the Hobby plan and 300 seconds on Pro/Enterprise; long replies or chained tool calls may time out, and maxDuration must be set in route.ts.
- Vercel cold starts may reach 1-2 seconds; if stable sub-second responses are needed, Edge Functions must be used or low-traffic warming arranged.
- If the signing key is rotated in the dashboard, the new value must be deployed before triggering new events, otherwise Chamade will retry until it enters the DLQ.
- Cross-message memory requires replacing the in-memory SEEN set with Vercel KV or Upstash Redis and storing conversation history by conversation_id.
- Scenarios such as voice (call.transcript) must be extended in the switch by calling replyCallSay from lib/chamade.ts.
- Events other than dm.received, agent.timeout, and webhook.test are only acknowledged, and route.ts must be extended to connect scenarios such as voice.
View Original Text Basis
Permission is hereby granted, free of charge
Original License Text
| `CHAMADE_WEBHOOK_SECRET` | yes | One-time reveal in `/dashboard/keys` after saving the webhook URL |
Original README
| `ANTHROPIC_API_KEY` | yes | <https://console.anthropic.com> |
Original README
| `CHAMADE_BASE_URL` | no | Defaults to `https://chamade.io`. Set to `https://dev.chamade.io` to test against dev |
Original README
| `ANTHROPIC_MODEL` | no | Defaults to `claude-sonnet-4-6` |
Original README
> ⚠️ **Use the stable alias, NOT the per-deploy URL.**
Original README
- **Idempotency persistence**: the starter uses an in-memory Set keyed by `event_id`. For multi-region Vercel deployments use KV/Redis instead — retries from the same instance dedupe locally, retries that bounce across regions need shared state.
Original README
- Vercel function timeout: Hobby plan caps at 60s, Pro/Enterprise at 300s. Long Claude responses + chained tool use can exceed this — set `maxDuration` in `route.ts` to match your plan
Original README
- Cold starts on Vercel can hit 1-2s; if you need consistently sub-second replies, use Vercel Edge Functions (swap `runtime = "nodejs"` to `"edge"` — `crypto` from `node:crypto` is available in the Edge runtime since 2024) or pre-warm with a low-traffic ping schedule
Original README
- The signature verifies against `process.env.CHAMADE_WEBHOOK_SECRET` — if you rotate it in the dashboard, deploy the new value too **before** any new event fires, otherwise Chamade retries until DLQ
Original README
- **Memory across messages**: replace the in-memory `SEEN` set with Vercel KV or Upstash Redis; store conversation history keyed by `event.data.conversation_id`
Original README
- **Voice (`call.transcript`)**: add a case in the `switch` calling `replyCallSay(event, text)` from `lib/chamade.ts`
Original README
https://github.com/Nafis-Chamade/chamade-template-vercel-nextjs/blob/main/LICENSEhttps://github.com/Nafis-Chamade/chamade-template-vercel-nextjs/blob/main/README.md- **everything else** → ack only (extend `app/api/chamade-webhook/route.ts` as you wire voice etc.)
Original README
Compiled by DeepSeek based on repository license and README ·2026-10-14. Results only cover the materials read; dependencies, images, fonts, and subsequent term changes are subject to their respective original texts.
Project checks & description sources
Template Information
- Source platforms
- GitHub
- Documentation and maintenance reference score
- More documented · 80 / 100
- Technologies
- Next.js · React
- Website type
- Starter
How this score is calculated
Our heuristic uses license records (up to 30), a demo link (12), a preview (10), stars (15), recorded maintenance (15), description completeness (8), feature records (5) and classification data (5). It is not a code, security or performance test, or a Google score. A link does not establish tested functionality.
What to verify for this project
- Repository update recorded
- 2026-05-22
- Screenshot last checked
- 2026-10-16
A demo link is listed. Check it with your own content and viewport sizes; its presence does not confirm that forms, authentication or payments work.
The catalog identifies Next.js as the primary stack. Check the actual dependency manifest and lockfile for versions and hosting requirements. These notes use recorded metadata, not a code audit or a deployment test.
Use a selection guide →How this description was prepared
AI-assisted description based on catalog records and repository material. Repository authors are not automatically the reviewers of this description.
Review declaration: codex-user-requested-batch-review-20261017 · 2026-10-16
Inspect the recorded source material
SHA-256: a78e7905b048f1c60f5ddca7a9fedc87c62938a044c95693e8c139134f1d6bc7
2026-10-14T19:53:24.025Z
Source file / repository# Chamade webhook handler — Vercel starter Next.js 15 App Router. One API route at `/api/chamade-webhook` that: 1. Verifies the HMAC signature on the raw body 2. Dispatches `dm.received` to Claude (Anthropic SDK) 3. POSTs the model's reply back to Chamade via `/api/reply/dm` with the `reply_token` from the event Reference for the wire format: <https://chamade.io/docs/webhooks>. ## Deploy **1. Push to your GitHub** (Vercel needs a Git host; Codeberg/GitLab also work): ```bash cp -r docs/templates/vercel-nextjs ~/my-chamade-handler cd ~/my-chamade-handler git init && git add -A && git commit -m "init" && git remote add origin <your-repo> && git push -u origin main ``` **2. Import on Vercel:** New Project → pick the repo → set env vars (next step) → Deploy. **3. Set env vars** (Vercel project settings or `vercel env`): | Variable | Required | Notes | |---|---|---| | `CHAMADE_WEBHOOK_SECRET` | yes | One-time reveal in `/dashboard/keys` after saving the webhook URL | | `ANTHROPIC_API_KEY` | yes | <https://console.anthropic.com> | | `CHAMADE_BASE_URL` | no | Defaults to `https://chamade.io`. Set to `https://dev.chamade.io` to test against dev | | `ANTHROPIC_MODEL` | no | Defaults to `claude-sonnet-4-6` | **4. Copy the ALIAS URL** into Chamade dashboard → channel → Webhook → Configure. > ⚠️ **Use the stable alias, NOT the per-deploy URL.** > > The output of `vercel` shows a deploy-specific URL like > `https://chamade-handler-fw1y8znp6-<scope>.vercel.app`. Don't use that — > it's a frozen snapshot of one specific deploy. The next time you rotate > a secret or `vercel env add` a new var, **that URL keeps its original > env-var snapshot** and Chamade keeps hitting a stale function. > > Use the alias instead: `https://<project-name>.vercel.app/api/chamade-webhook` > (e.g. `https://chamade-handler.vercel.app/api/chamade-webhook`). The alias > auto-tracks every `vercel --prod` so your env-var rotations are honored. > > Check aliases with `npx vercel alias ls`. **5. Click "Send test" in the dashboard.** You should see HTTP 200 in the delivery log within a couple of seconds. ## What the handler does - **`dm.received`** → send `event.data.text` to Claude, post the reply to `/api/reply/dm` - **`agent.timeout`** → async-reply with a default "sorry for the delay" message - **`webhook.test`** → ack only (verifies signing works end-to-end) - **everything else** → ack only (extend `app/api/chamade-webhook/route.ts` as you wire voice etc.) ## Customizing - **System prompt / model behavior**: edit `handleDmReceived` in `app/api/chamade-webhook/route.ts` - **Memory across messages**: replace the in-memory `SEEN` set with Vercel KV or Upstash Redis; store conversation history keyed by `event.data.conversation_id` - **Voice (`call.transcript`)**: add a case in the `switch` calling `replyCallSay(event, text)` from `lib/chamade.ts` - **Idempotency persistence**: the starter uses an in-memory Set keyed by `event_id`. For multi-region Vercel deployments use KV/Redis instead — retries from the same instance dedupe locally, retries that bounce across regions need shared state. ## Local development ```bash npm install cp .env.example .env.local # fill CHAMADE_WEBHOOK_SECRET + ANTHROPIC_API_KEY npm run dev # in another terminal, expose with ngrok: ngrok http 3000 # paste the ngrok URL + /api/chamade-webhook into Chamade dashboard ``` Localhost + `*.ngrok-free.app` are HTTPS-bypassed in Chamade's dispatcher so http://localhost:3000 also works directly if you run Chamade in your own machine. ## Caveats - Vercel function timeout: Hobby plan caps at 60s, Pro/Enterprise at 300s. Long Claude responses + chained tool use can exceed this — set `maxDuration` in `route.ts` to match your plan - Cold starts on Vercel can hit 1-2s; if you need consistently sub-second replies, use Vercel Edge Functions (swap `runtime = "nodejs"` to `"edge"` — `crypto` from `node:crypto` is available in the Edge runtime since 2024) or pre-warm with a low-traffic ping schedule - The signature verifies against `process.env.CHAMADE_WEBHOOK_SECRET` — if you rotate it in the dashboard, deploy the new value too **before** any new event fires, otherwise Chamade retries until DLQ ## License Pick whatever you ship under — this starter is MIT.
Explore similar templates
Compare previews and descriptions within the same stack and category.

Next.js SaaS Starter
The official Next.js SaaS starter template, integrating email/password authentication, Stripe Checkout subscriptions, a dashboard with user/team CRUD, basic Owner/Member RBAC, and activity logging.
Next.js · SaaS

Next.js Commerce
Vercel's officially maintained Next.js App Router ecommerce starter with deep Shopify integration, offering a complete product catalog, cart, and checkout flow. Core logic is modular for swapping backends, and community provider versions exist for BigCommerce, Medusa, and Saleor.
Next.js · E-commerce

Next-js-Boilerplate
A developer-first Next.js 16 starter with Tailwind CSS 4 and TypeScript, supporting both App Router and Page Router.
Next.js · Starter

tailwind-nextjs-starter-blog
A Next.js and Tailwind CSS blog starter template using Contentlayer for Markdown/MDX, with built-in SEO, code highlighting, and tags. It targets personal technical blogs and migration from Jekyll/Hugo to React, and supports one-click Vercel deployment.
Next.js · Blog

next-forge
next-forge is a Turborepo-based Next.js template maintained by Vercel, positioned as a starting point for SaaS products.
Next.js · Starter

SaaS-Boilerplate
SaaS-Boilerplate is an open-source SaaS starter template built with Next.js App Router, React 19, TypeScript, Tailwind CSS, and Shadcn UI.
Next.js · SaaS
