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
- Instant text responses without voice processing
- Maintains conversation context across multiple messages
- Compatible with existing OpenAI workflows
Prerequisites
- A CallHQ account
- An existing assistant or willingness to create one
- Basic knowledge of making API requests
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
Open the CallHQ Dashboard
Go to web.callhq.ai and log in to your account.
2. Create or Select an Assistant
Create a new assistant (or use existing)
- Click
Create Assistantif you need a new one - Select
Blank Templateas your starting point - Name it
TechFlow Support - Set the first message to:
Hello! I'm here to help with TechFlow questions. What can I assist you with today?
3. Create a Chat Session
4. Send Your First Chat Message
Test with curl
Use the session ID from the previous step to send your first message:
First Chat Request
5. Build a Multi-Turn Conversation
Continue the conversation
Use the same session ID to maintain context across multiple messages:
Follow-up Message
Test context awareness
Send another message to verify the assistant remembers the conversation:
Context Test
6. Pass Dynamic Variables
Configure variables in your assistant
In your assistant’s system prompt, you can reference dynamic variables using
{{variableName}} syntax:System Prompt with Variables
7. Integrate with TypeScript
8. Test Your Chat Bot
Test various scenarios
Try these test cases to ensure your chat bot works correctly:
Test Case 1: General Question
Test Case 2: Technical Issue
Verify conversation memory
Send follow-up messages using the same session ID to ensure context is maintained.
Limitations
Current chat functionality limitations:
- “Query” tool for knowledge-base searches is not yet supported
- 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
Need help? Contact the team at [email protected] or visit our Dashboard.