Create a Chatbot
Create a Chatbot
This endpoint allows you to programmatically create a new chatbot within your Nexvio.ai account.
Endpoint
POST https://api.nexvio.ai/v1/chatbotsHeaders
| Name | Required | Description |
|---|---|---|
Authorization | Yes | Your API key in the format: Bearer YOUR_API_KEY |
Content-Type | Yes | Must be application/json |
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | The name of your chatbot |
welcome_message | string | No | Initial message displayed when a user opens the chatbot |
model | string | No | AI model to use. Options: gpt-3.5-turbo, gpt-4. Default: gpt-3.5-turbo |
instructions | string | No | System instructions that define your chatbot’s personality and knowledge |
team_id | string | No | The team ID if you want to assign this chatbot to a specific team |
appearance | object | No | Configuration for the chatbot’s visual appearance (see below) |
Appearance Object
| Parameter | Type | Required | Description |
|---|---|---|---|
primary_color | string | No | Primary color for the chatbot UI (hex code) |
chat_bubble_button_style | string | No | Style of the chat button. Options: round, square |
position | string | No | Position of the chat widget. Options: bottom-right, bottom-left, top-right, top-left |
chatbox_header_text | string | No | Text to display in the chatbox header |
hide_branding | boolean | No | Whether to hide Nexvio.ai branding. Requires enterprise plan. Default: false |
Example Request
{ "name": "Sales Assistant", "welcome_message": "Hello! I'm your sales assistant. How can I help you today?", "model": "gpt-4", "instructions": "You are a sales assistant for Acme Corp, a software company that specializes in CRM solutions. Be friendly, helpful, and knowledgeable about our products. Our main product is AcmeCRM, which starts at $29/month. Refer technical support questions to support@acmecorp.com.", "team_id": "team_123abc", "appearance": { "primary_color": "#4A90E2", "chat_bubble_button_style": "round", "position": "bottom-right", "chatbox_header_text": "Sales Support", "hide_branding": false }}Response
{ "status": "success", "data": { "chatbot": { "id": "chatbot_456def", "team_id": "team_123abc", "name": "Sales Assistant", "welcome_message": "Hello! I'm your sales assistant. How can I help you today?", "model": "gpt-4", "instructions": "You are a sales assistant for Acme Corp...", "appearance": { "primary_color": "#4A90E2", "chat_bubble_button_style": "round", "position": "bottom-right", "chatbox_header_text": "Sales Support", "hide_branding": false }, "created_at": "2023-07-15T12:30:45Z", "updated_at": "2023-07-15T12:30:45Z" } }}Error Responses
Authentication Error
{ "status": "error", "error": { "code": "unauthorized", "message": "Invalid API key" }}Validation Error
{ "status": "error", "error": { "code": "validation_error", "message": "Invalid request data", "details": { "name": "Name is required" } }}Plan Limit Error
{ "status": "error", "error": { "code": "plan_limit_exceeded", "message": "Your current plan allows a maximum of 5 chatbots. Please upgrade your plan to create more." }}Notes
- Creating a chatbot does not automatically make it accessible to your users. You’ll need to configure sources, deploy it to your website, or integrate it with other platforms.
- The model selection affects pricing. Advanced models like GPT-4 may incur additional costs based on your plan.
- To upload a profile picture or icon for your chatbot, use the separate upload endpoints after creating the chatbot.
Code Examples
cURL
curl -X POST "https://api.nexvio.ai/v1/chatbots" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "name": "Sales Assistant", "welcome_message": "Hello! How can I help you today?", "model": "gpt-3.5-turbo", "instructions": "You are a friendly sales assistant..." }'JavaScript
const response = await fetch('https://api.nexvio.ai/v1/chatbots', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json' }, body: JSON.stringify({ name: 'Sales Assistant', welcome_message: 'Hello! How can I help you today?', model: 'gpt-3.5-turbo', instructions: 'You are a friendly sales assistant...' })});
const data = await response.json();console.log(data);Python
import requests
url = "https://api.nexvio.ai/v1/chatbots"headers = { "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json"}payload = { "name": "Sales Assistant", "welcome_message": "Hello! How can I help you today?", "model": "gpt-3.5-turbo", "instructions": "You are a friendly sales assistant..."}
response = requests.post(url, headers=headers, json=payload)data = response.json()print(data)