The short answer: add your Vistara API key to the Repl's Secrets as VISTARA_API_KEY, paste the prompt from vistaraai.in/integration/replit into Replit Agent, and follow along. Replit Agent builds and tests your voice agent with a live call to your phone, adds the server code that starts calls, and receives each call's result on your Repl's public URL.
Why Replit makes this easy
Vistara sends call results to a webhook URL that must be reachable from the internet — localhost is rejected. On a laptop that means setting up a tunnel. On Replit your app already has a public URL, so the webhook works while you develop.
Step 1: Add your Secrets
VISTARA_API_KEY— from the Connect page at app.vistaraai.in.VISTARA_WEBHOOK_TOKEN— a random string of 32+ characters that protects your webhook URL.VISTARA_AGENT_ID— add it once your agent exists.
Replit Agent reads them from Secrets and never writes them into code.
Step 2: Paste the prompt into Replit Agent
Open your Repl, start Replit Agent, and paste the prompt. The agent checks the key is set without printing it, lists your Vistara agents, and asks whether to use one or build a new one.
Step 3: Build the agent and take a test call
Answer a few questions about your use case; the agent writes the voice agent's prompt and creates it after you approve. Then it confirms your number and places a test call. Test calls work at any time of day (up to five per minute), while regular calls wait for the 09:00–20:00 IST calling window.
Step 4: The server code
Replit Agent sets up an Express or FastAPI server — or extends the one you have — with a route that starts calls and a webhook route. For FastAPI, the webhook looks like this:
@app.post("/webhooks/vistara")
async def vistara_webhook(request: Request, background: BackgroundTasks, token: str = ""):
if not hmac.compare_digest(token, os.environ["VISTARA_WEBHOOK_TOKEN"]):
raise HTTPException(status_code=401)
payload = await request.json()
call_id, event = payload.get("callId"), payload.get("event")
if not call_id or not event:
raise HTTPException(status_code=400)
if save_call_event(call_id, event, payload): # False if already processed
background.add_task(process_call_result, call_id)
return {"ok": True}
Step 5: Point the agent's webhook at your Repl
The webhook URL is your Repl's public URL plus /webhooks/vistara?token=…. Replit Agent saves it on the agent through the API. When you deploy, the URL changes — update the agent's webhook URL to the deployed address, or better, keep a test agent on the development URL and a production agent on the deployed one.
Step 6: A screen to place calls and see results
Ask Replit Agent for a small UI: a test-call form (phone and name), a calls table with status badges, and a detail view with the summary, answers, transcript and an audio player for the recording. The form calls your own server route — never Vistara directly from the browser.