Update a Chatbot
Update a Chatbot
This endpoint allows you to update the configuration of an existing chatbot in your Nexvio.ai account.
Endpoint
PATCH https://api.nexvio.ai/v1/chatbots/{chatbotId}Headers
| Name | Required | Description |
|---|---|---|
Authorization | Yes | Your API key in the format: Bearer YOUR_API_KEY |
Content-Type | Yes | Must be application/json |
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
chatbotId | string | Yes | The ID of the chatbot to update |
Request Body
All fields are optional. Only include the fields you want to update.
| Parameter | Type | Description |
|---|---|---|
name | string | The name of your chatbot |
welcome_message | string | Initial message displayed when a user opens the chatbot |
model | string | AI model to use. Options: gpt-3.5-turbo, gpt-4 |
instructions | string | System instructions that define your chatbot’s personality and knowledge |
team_id | string | The team ID if you want to reassign this chatbot to a different team |
appearance | object | Configuration for the chatbot’s visual appearance (see below) |
Appearance Object
| Parameter | Type | Description |
|---|---|---|
primary_color | string | Primary color for the chatbot UI (hex code) |
chat_bubble_button_style | string | Style of the chat button. Options: round, square |
position | string | Position of the chat widget. Options: bottom-right, bottom-left, top-right, top-left |
chatbox_header_text | string | Text to display in the chatbox header |
hide_branding | boolean | Whether to hide Nexvio.ai branding. Requires enterprise plan |
Example Request
{ "name": "Updated Sales Assistant", "welcome_message": "Welcome back! How can I help you with our products today?", "model": "gpt-4", "instructions": "You are a sales assistant for Acme Corp, specialized in our new premium CRM solution AcmeCRM Pro. Focus on highlighting the new AI-powered features and enterprise integrations. For detailed pricing, direct users to book a demo call.", "appearance": { "primary_color": "#2A52BE", "chatbox_header_text": "Acme Sales Team" }}Response
{ "status": "success", "data": { "chatbot": { "id": "chatbot_456def", "team_id": "team_123abc", "name": "Updated Sales Assistant", "welcome_message": "Welcome back! How can I help you with our products today?", "model": "gpt-4", "instructions": "You are a sales assistant for Acme Corp, specialized in our new premium CRM solution AcmeCRM Pro...", "appearance": { "primary_color": "#2A52BE", "chat_bubble_button_style": "round", "position": "bottom-right", "chatbox_header_text": "Acme Sales Team", "hide_branding": false }, "created_at": "2023-07-15T12:30:45Z", "updated_at": "2023-07-17T09:12:34Z" } }}Error Responses
Authentication Error
{ "status": "error", "error": { "code": "unauthorized", "message": "Invalid API key" }}Not Found Error
{ "status": "error", "error": { "code": "not_found", "message": "Chatbot not found" }}Validation Error
{ "status": "error", "error": { "code": "validation_error", "message": "Invalid request data", "details": { "model": "Invalid model specified. Allowed values: gpt-3.5-turbo, gpt-4" } }}Notes
- Only include the fields you want to update in the request body. Omitted fields will remain unchanged.
- Changing the AI model may affect pricing based on your plan.
- To update the chatbot’s sources, use the specific endpoints for managing sources.
- To update the profile picture or icon, use the separate upload endpoints.
Special Considerations
Updating Instructions
When updating the instructions field, keep in mind:
- The new instructions will apply to all future conversations
- Existing conversations in progress will continue to use the previous instructions
- Instructions should be comprehensive, as they define your chatbot’s personality and knowledge
- Maximum length for instructions is 32,000 characters
Changing Models
When changing the AI model:
- GPT-4 offers higher quality responses but may be slower and more expensive than GPT-3.5-Turbo
- Make sure your plan supports the selected model
- Consider testing the new model in a staging environment before updating a production chatbot
Code Examples
cURL
curl -X PATCH "https://api.nexvio.ai/v1/chatbots/chatbot_456def" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "name": "Updated Sales Assistant", "welcome_message": "Welcome back! How can I help you with our products today?", "appearance": { "primary_color": "#2A52BE" } }'JavaScript
const chatbotId = 'chatbot_456def';const response = await fetch(`https://api.nexvio.ai/v1/chatbots/${chatbotId}`, { method: 'PATCH', headers: { 'Authorization': 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json' }, body: JSON.stringify({ name: 'Updated Sales Assistant', welcome_message: 'Welcome back! How can I help you with our products today?', appearance: { primary_color: '#2A52BE' } })});
const data = await response.json();console.log(data);Python
import requests
chatbot_id = "chatbot_456def"url = f"https://api.nexvio.ai/v1/chatbots/{chatbot_id}"headers = { "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json"}payload = { "name": "Updated Sales Assistant", "welcome_message": "Welcome back! How can I help you with our products today?", "appearance": { "primary_color": "#2A52BE" }}
response = requests.patch(url, headers=headers, json=payload)data = response.json()print(data)