AI-generated app from Vercel
WhatsApp in v0: a Next.js server route and keys in environment variables
v0 generates interfaces and apps from a conversation and, according to its documentation (overview read on 2026-11-11), publishes in one click on Vercel's infrastructure and lets you connect a backend. The page I read does not detail environment variables or server routes: that is why this page shows the security pattern that holds for any Next.js app and makes clear what you should confirm in the tool's own menu.
Updated on
Why connect
You generated a lead form or a dashboard and want the WhatsApp sending to happen on the server. In Next.js that is a route handler: the browser calls your route, and the route calls ZapZap with the key held in an environment variable without the NEXT_PUBLIC_ prefix (variables with that prefix go to the browser). ZapZap connects numbers through an unofficial channel: WhatsApp may limit or block any number, so pacing, consent and warm-up matter. It costs R$15 per active number per month, prepaid, with no per-message fee, and you start with a welcome credit when you verify your phone, subject to the current campaign.
Step by step
- 1
Find where v0 stores environment variables
The documentation I read (overview, 2026-11-11) does not cover environment variables, and the variables page I tried to open does not exist. Look for the project's variables menu in the tool itself or in the project settings on Vercel after deploy, and confirm there before pasting any key.
- 2
Register the three values without a public prefix
Create ZAPZAP_API_KEY, ZAPZAP_API_SECRET and ZAPZAP_INSTANCE_ID, without NEXT_PUBLIC_ in the name. The keys come from Settings > API at app.zapzapapi.com and the instance is a number connected by QR code.
- 3
Ask for the server route
Prompt: "Create a POST route handler at app/api/whatsapp/route.ts that validates number (10 to 15 digits) and text, and calls https://api.zapzapapi.com/api/v1/{instanceId}/send/text with x-api-key and x-api-secret from process.env. Do not expose the keys to the client."
- 4
Connect the form to the route
The component calls fetch('/api/whatsapp', { method: 'POST', ... }) with number and text. Add a rate limit per IP or per user on the route: without it, any visitor can use your number to send.
- 5
Publish and test with your own number
After the deploy, send to yourself, check the HTTP response and use GET /{instanceId}/instance/status to see whether the instance is connected.
Example
// app/api/whatsapp/route.ts (Next.js route handler: runs on the server, the key never reaches the browser)
// Environment variables (NO NEXT_PUBLIC_ prefix): ZAPZAP_API_KEY, ZAPZAP_API_SECRET, ZAPZAP_INSTANCE_ID
export async function POST(req: Request) {
const { number, text } = await req.json();
if (!/^\d{10,15}$/.test(String(number)) || typeof text !== "string" || !text) {
return Response.json({ error: "invalid number or text" }, { status: 400 });
}
const r = await fetch("https://api.zapzapapi.com/api/v1/" + process.env.ZAPZAP_INSTANCE_ID + "/send/text", {
method: "POST",
headers: {
"Content-Type": "application/json",
"x-api-key": process.env.ZAPZAP_API_KEY ?? "",
"x-api-secret": process.env.ZAPZAP_API_SECRET ?? "",
},
body: JSON.stringify({ number, text }),
});
return new Response(await r.text(), { status: r.status, headers: { "Content-Type": "application/json" } });
}Illustrative. The exact fields and endpoints are in the documentation.
What I read and what I could not confirm about v0
- Confirmed (v0.app/docs, 2026-11-11): one-click publishing on Vercel's infrastructure and connecting a backend.
- Not stated on the page I read: environment variables, server routes and how to keep keys on the server.
- The server-route pattern is Next.js, not a v0-only feature: confirm in your project that the generated code is Next.js.
Frequently asked questions
Does v0 have a ready-made ZapZap integration?
No. The connection is code: a server route that calls the REST API. There is no v0 extension maintained by ZapZap.
Can I use NEXT_PUBLIC_ on the key to make it easier?
No. Variables with that prefix are sent to the browser, and anyone could read the key and use your number.
How do I receive customer replies?
With a webhook: create another POST route, register the public URL with PUT /instances/{id}/webhook and validate X-ZapZap-Signature over the raw body.
Is ZapZap official WhatsApp?
No. It is an unofficial solution, and WhatsApp may limit or block numbers.
What does it cost?
It costs R$15 per active number per month, prepaid, with no per-message fee, and you start with a welcome credit when you verify your phone, subject to the current campaign.
Start now
Create your account, connect a number in minutes and test the API with warm-up and anti-ban. R$15 per active number/month, prepaid, no lock-in.
