Chat quickstart
Build your first text-based conversation with a Vapi assistant in 5 minutes
Overview
Build a customer service chat bot that can handle text-based conversations through your application. Perfect for adding AI chat to websites, mobile apps, or messaging platforms.
What You’ll Build:
- A working chat integration that responds to user messages
- Context-aware conversations that remember previous messages
- Both one-shot and multi-turn conversation patterns
Agent Capabilities:
- Instant text responses without voice processing
- Maintains conversation context across multiple messages
- Compatible with existing OpenAI workflows
Prerequisites
- A Vapi account
- An existing assistant or willingness to create one
- Basic knowledge of making API requests
- For a pay-as-you-go subscription, the billing setup described in Troubleshooting
Scenario
We’ll create a customer support chat for “TechFlow”, a software company that wants to handle common questions via text chat before escalating to human agents.
1. Get Your API Credentials
Get your Vapi private API key
Follow the Vapi API key guide to create, view, or copy a private key. Use this key to authenticate server-side chat requests.
Keep this key secure - never expose it in client-side code.
2. Create or Select an Assistant
3. Send Your First Chat Message
4. Build a Multi-Turn Conversation
5. Pass Dynamic Variables
6. Integrate with TypeScript
7. Test Your Chat Bot
Troubleshooting
The Chat API returns HTTP 402 when the pay-as-you-go organization does not meet a billing requirement. Use the message to identify the required action.
Frequently asked questions
What billing setup is required to use chat?
Every pay-as-you-go organization needs a saved payment method. During the subscription’s first 30 days, the organization must also have completed a payment. Enterprise and agency plans do not have these requirements.
Does this requirement affect voice calls?
No. The purchase requirement applies only to chat.
Does adding a card count as a completed purchase?
No. Adding a card authorizes future charges but does not complete a payment. To unblock chat during the first 30 days, buy credits or complete another purchase.
Does the completed payment expire?
No. One completed payment permanently satisfies the requirement for the organization. The payment does not need to be recent or recurring.
What happens after the first 30 days?
The completed-payment requirement ends when the pay-as-you-go subscription reaches 30 days old. The organization still needs a saved payment method to use chat.
How quickly does access return after payment?
Chat access usually returns within one minute after the payment settles. If chat remains blocked, wait one minute, refresh the Dashboard, and try again.
Limitations
Current chat functionality limitations:
- Server webhook events (status updates, end-of-call reports, etc.) are not supported
Webhook Support
The chat API supports the following webhook events through server messaging:
chat.created- Triggered when a new chat conversation is initiatedchat.deleted- Triggered when a chat conversation is deleted
To receive these webhooks, go to your Assistant page in the Dashboard and navigate to “Server Messaging” and select the events you want to receive.
These webhooks are useful for tracking conversation analytics, maintaining conversation history in your own database, and triggering follow-up actions.
Next Steps
Take your chat bot to the next level:
- Streaming responses - Add real-time typing indicators and progressive responses
- Non-streaming responses - Learn about sessions and complex conversation flows
- Session management - Learn advanced context management with sessions and previousChatId
- OpenAI compatibility - Integrate with existing OpenAI workflows