CLI Documentation
Installation
npm install -g @chatbotkit/cli # or yarn global add @chatbotkit/cli
shell
Environment Setup
Before using the CLI, set up your environment variables:
export CHATBOTKIT_SECRET="your-api-secret" # Optional: For partner API access export RUNAS_USERID="optional-user-id"
shell
Command Reference
Basic Commands
# Get help chatbotkit --help # Check version chatbotkit --version
shell
Bot Management
# Create a new bot chatbotkit create bot --name "CustomerSupport" --model "gpt-4" # List all bots chatbotkit list bots # Get bot details chatbotkit get bot <bot-id> # Update bot chatbotkit update bot <bot-id> --name "NewName" # Delete bot chatbotkit delete bot <bot-id>
shell
Dataset Management
# Create a dataset chatbotkit create dataset --name "Training Data" --visibility private # List datasets chatbotkit list datasets # Upload data to dataset chatbotkit dataset upload <dataset-id> --file data.json # Delete dataset chatbotkit delete dataset <dataset-id>
shell
Integration Commands
# Set up website integration chatbotkit create integration sitemap \\ --url "<https://example.com/sitemap.xml>" \\ --name "Website Crawler" # Create widget integration chatbotkit create integration widget \\ --name "Chat Widget" \\ --theme light \\ --position right # List integrations chatbotkit list integrations
shell
Interactive Input
# The CLI will prompt for confirmation chatbotkit delete bot <bot-id> --confirm # Prompt for input if not provided chatbotkit create bot
shell
Configuration Files
You can use YAML files for complex configurations:
# config.yaml name: MyBot type: bot config: model: gpt-4 temperature: 0.7 backstory: "A helpful assistant"
yaml
# Apply configuration chatbotkit apply -f config.yaml
shell
Common Usage Examples
Setting up a Complete Bot
# 1. Create a new bot chatbotkit create bot \\ --name "Support Assistant" \\ --model "gpt-4" \\ --backstory "Customer support specialist" # 2. Create and upload training data chatbotkit create dataset --name "Support FAQ" chatbotkit dataset upload <dataset-id> --file faq.json # 3. Link dataset to bot chatbotkit bot link <bot-id> --dataset <dataset-id>
shell
Managing Website Integration
# Start website crawling chatbotkit integration sitemap create \\ --url "<https://example.com/sitemap.xml>" \\ --name "Website Data" \\ --crawl-depth 2 # Check crawl status chatbotkit integration sitemap status <integration-id>
shell
Deployment Management
# Deploy a configuration chatbotkit deploy -f solution.yaml # Check deployment status chatbotkit deploy status <deployment-id> # Rollback deployment chatbotkit deploy rollback <deployment-id>
shell
Error Handling
The CLI provides clear error messages:
# Example of handling missing credentials $ chatbotkit list bots Error: CHATBOTKIT_SECRET environment variable not set Please set your API secret using: export CHATBOTKIT_SECRET="your-api-secret" # Example of invalid resource ID $ chatbotkit get bot invalid-id Error: Bot not found: invalid-id
shell
Best Practices
- Always use
-confirm
for destructive operations - Use configuration files for complex setups
- Check operation status after async operations
- Use environment variables for credentials
- Regularly backup configurations
Would you like me to expand on any specific commands or add more usage examples?