The short answer: save the Vistara AI integration prompt from vistaraai.in/integration/claude in your project as VISTARA.md, store your API key as VISTARA_API_KEY, and ask Claude Code to follow the file. Claude Code checks your key, helps you build a voice agent, places a test call to your phone, and then writes the call-starting code, the webhook endpoint and the data model into your repository.
Why Claude Code fits this job
Claude Code works in your terminal or IDE with access to your repository and shell. That means it can do the whole loop itself: run the Vistara API calls, read the responses, and edit your code — while you stay in charge of the decisions. Claude on the web or desktop works too, but there you run each command yourself and paste the response back.
Before you start
- A Vistara AI account — sign up at app.vistaraai.in with an Indian mobile number. New accounts get ₹150 free credit with a GSTIN (₹50 without), up to 200 calls since unanswered calls are never charged.
- Your API key from the Connect page, stored as an environment variable:
export VISTARA_API_KEY="..."on macOS or Linux,$env:VISTARA_API_KEY = "..."in PowerShell, or a.envfile that is listed in.gitignore. - Claude Code opened in your project folder.
Step 1: Put the prompt in your project
On the Claude integration page, choose Download as .md File and save it at the root of your repository as VISTARA.md. Then tell Claude Code: "Read VISTARA.md and follow it to add Vistara AI voice calling to this project." Pasting the prompt works as well; the file simply lets Claude re-read the full guide at any point in a long session.
Step 2: Let Claude Code check your setup
Claude Code confirms VISTARA_API_KEY is set without printing it, then lists your active agents. A successful response confirms the key works; a 401 means the key is missing or wrong. You then choose: use one of your agents, improve one, or build a new one.
Step 3: Build the voice agent
Claude asks a handful of questions — company, the purpose of the call, language, the agent's name and voice, what to capture after each call, and which per-customer details your system will send (for example plan_name or renewal_due_date). It then writes a ten-section agent prompt using Vistara's Voice Agent Builder, saves it in your repository so it is version-controlled, and creates the agent after you approve it. Any business fact it doesn't know stays marked [TO FILL] until you supply it, so the agent never invents prices or dates.
Step 4: Take the test call
Claude repeats your number back, places a test call (test calls are allowed at any time of day, up to five per minute) and waits for the result. Then it shows you the summary, sentiment, extracted answers, the recording link and the parts of the transcript that matter. Tell it what to change — a line that sounded robotic, a question asked twice — and it updates the agent and offers another test call.
Step 5: Let it write the integration
Claude Code looks at your stack and builds inside your existing structure:
- a Vistara client with
startCallandgetCall, 15-second timeouts and retries only where they are safe — it never automatically retries starting a call, because there is no idempotency key and a blind retry could ring a customer twice; - a webhook route that checks a secret token, saves each result by
callIdand answers 200 straight away; - a
voice_callstable and a reconciliation job for webhooks that never arrived; - the place calls start from — a "Call now" button, an event such as a new lead, or a scheduled batch.
// Behind a "Call now" button — server-side only
const callId = await startCall({
phone: lead.phone,
name: lead.name,
metadata: { lead_id: lead.id, plan_name: lead.plan },
});
Step 6: Go live
Before real customers are called, Claude walks you through the checklist: a production agent separate from the test agent, the webhook URL with its secret token, the key only in server-side environment variables, an alert when the wallet runs low, calls scheduled inside the 09:00–20:00 IST window, a redial policy for unanswered calls and an opt-out list.
Tips from real integrations
- Keep the key out of the chat. Claude Code reads it from the environment; there is no need to paste it.
- Webhooks need a public URL. Vistara rejects localhost, so expose your local server with a tunnelling tool and set that URL on a test agent.
- Use two agents. The webhook URL belongs to the agent, so separate "Sales – Test" and "Sales – Production" agents keep test traffic out of production.