Skip to content

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

NameRequiredDescription
AuthorizationYesYour API key in the format: Bearer YOUR_API_KEY
Content-TypeYesMust be application/json

Path Parameters

ParameterTypeRequiredDescription
chatbotIdstringYesThe ID of the chatbot to update

Request Body

All fields are optional. Only include the fields you want to update.

ParameterTypeDescription
namestringThe name of your chatbot
welcome_messagestringInitial message displayed when a user opens the chatbot
modelstringAI model to use. Options: gpt-3.5-turbo, gpt-4
instructionsstringSystem instructions that define your chatbot’s personality and knowledge
team_idstringThe team ID if you want to reassign this chatbot to a different team
appearanceobjectConfiguration for the chatbot’s visual appearance (see below)

Appearance Object

ParameterTypeDescription
primary_colorstringPrimary color for the chatbot UI (hex code)
chat_bubble_button_stylestringStyle of the chat button. Options: round, square
positionstringPosition of the chat widget. Options: bottom-right, bottom-left, top-right, top-left
chatbox_header_textstringText to display in the chatbox header
hide_brandingbooleanWhether 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:

  1. The new instructions will apply to all future conversations
  2. Existing conversations in progress will continue to use the previous instructions
  3. Instructions should be comprehensive, as they define your chatbot’s personality and knowledge
  4. Maximum length for instructions is 32,000 characters

Changing Models

When changing the AI model:

  1. GPT-4 offers higher quality responses but may be slower and more expensive than GPT-3.5-Turbo
  2. Make sure your plan supports the selected model
  3. Consider testing the new model in a staging environment before updating a production chatbot

Code Examples

cURL

Terminal window
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)