Basic Chatbot

Build your first AI chatbot with BroxiAI in under 10 minutes

Learn how to create a simple but powerful AI chatbot using BroxiAI's visual workflow builder.

What You'll Build

A conversational AI chatbot that can:

  • Respond to user messages naturally

  • Maintain conversation context

  • Handle various types of questions

  • Provide helpful and engaging responses

Prerequisites

  • BroxiAI account (sign up at use.broxi.ai)

  • OpenAI API key (or another supported AI provider)

  • 10 minutes of your time

Step 1: Set Up Your Workspace

  1. Log into BroxiAI

  2. Create a New Flow

    • Click "New Flow" from your dashboard

    • Name your flow "My First Chatbot"

    • Select "Blank Flow" to start from scratch

  3. Configure API Keys

    • Go to Settings → API Keys

    • Add your OpenAI API key

    • Save the configuration

Step 2: Add Core Components

Chat Input Component

  1. Drag Chat Input from the Components sidebar

  2. Configure the component:

    {
      "name": "User Message",
      "placeholder": "Type your message here...",
      "session_id": "user_session"
    }

AI Model Component

  1. Drag OpenAI Model from the AI Models section

  2. Configure the model:

    {
      "model": "gpt-3.5-turbo",
      "temperature": 0.7,
      "max_tokens": 500,
      "system_message": "You are a helpful and friendly AI assistant. Provide clear, concise, and helpful responses to user questions."
    }

Chat Output Component

  1. Drag Chat Output from the Components sidebar

  2. Configure for display:

    {
      "name": "AI Response",
      "show_in_playground": true
    }

Step 3: Connect the Components

  1. Connect Chat Input to OpenAI Model

    • Drag from the output handle (⚪) of Chat Input

    • Connect to the "input" port of the OpenAI Model

  2. Connect OpenAI Model to Chat Output

    • Drag from the output handle of OpenAI Model

    • Connect to the input port of Chat Output

Your workflow should look like this:

Step 4: Test Your Chatbot

  1. Open the Playground

    • Click the "Playground" button in the top-right corner

    • The chat interface will appear

  2. Start Chatting

    • Type a message like "Hello, how are you?"

    • Press Enter or click Send

    • Watch your AI respond!

  3. Try Different Prompts

    Examples to try:
    - "What's the weather like?" 
    - "Tell me a joke"
    - "Explain quantum computing"
    - "Help me write an email"

Step 5: Enhance Your Chatbot

Add Memory for Context

  1. Add Conversation Memory

    • Drag "Conversation Buffer Memory" component

    • Place it between Chat Input and OpenAI Model

  2. Configure Memory:

    {
      "memory_key": "chat_history",
      "max_token_limit": 2000,
      "return_messages": true
    }
  3. Update Connections

    • Connect Chat Input → Memory → OpenAI Model → Chat Output

Customize the Personality

Update the system message in your OpenAI Model:

You are Alex, a knowledgeable and friendly AI assistant who works for BroxiAI. 

Your personality:
- Enthusiastic about AI and technology
- Always helpful and patient
- Uses a conversational tone
- Provides practical advice
- Asks follow-up questions when helpful

Remember to:
- Keep responses concise but informative
- Use examples when explaining concepts
- Be encouraging and supportive
- Maintain a professional yet friendly demeanor

Add Response Validation

  1. Add Text Processor component after OpenAI Model

  2. Configure validation:

    {
      "max_length": 1000,
      "remove_profanity": true,
      "format_markdown": true
    }

Step 6: Deploy Your Chatbot

Publish Your Workflow

  1. Test Thoroughly

    • Try various input types

    • Verify responses are appropriate

    • Check conversation flow

  2. Publish the Flow

    • Click "Publish" in the API Access panel

    • Copy your API endpoint

    • Note your flow ID

Integration Options

Web Integration

<script>
async function sendMessage(message) {
  const response = await fetch('https://api.broxi.ai/v1/flows/YOUR_FLOW_ID/run', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer YOUR_API_TOKEN',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      input: message,
      session_id: 'user_123'
    })
  });
  
  const result = await response.json();
  return result.output;
}
</script>

Python Integration

import requests

def chat_with_bot(message, session_id="default"):
    response = requests.post(
        "https://api.broxi.ai/v1/flows/YOUR_FLOW_ID/run",
        headers={
            "Authorization": "Bearer YOUR_API_TOKEN",
            "Content-Type": "application/json"
        },
        json={
            "input": message,
            "session_id": session_id
        }
    )
    
    return response.json()["output"]

# Usage
response = chat_with_bot("Hello, how can you help me?")
print(response)

Advanced Features

Add Knowledge Base

  1. Upload Documents

    • Use File Manager to upload relevant documents

    • Add Document Loader component

    • Connect to Text Splitter

  2. Create Vector Database

    • Add Vector Database component

    • Configure embeddings

    • Store document chunks

  3. Implement RAG

    • Add Retrieval component

    • Connect to your vector database

    • Enhance model with retrieved context

Multi-Language Support

  1. Add Language Detection

    • Insert Language Detector component

    • Identify user's language automatically

  2. Add Translation

    • Use Translation component

    • Translate responses to user's language

Analytics and Monitoring

  1. Track Conversations

    • Log user interactions

    • Monitor response quality

    • Analyze usage patterns

  2. Set Up Alerts

    • Monitor error rates

    • Track response times

    • Set up usage notifications

Troubleshooting

Common Issues

Bot Not Responding

  • Check API key configuration

  • Verify component connections

  • Review error logs in the Playground

Poor Response Quality

  • Adjust temperature settings

  • Improve system message

  • Add more context or examples

Memory Issues

  • Check memory configuration

  • Adjust token limits

  • Clear conversation history if needed

Next Steps

Congratulations! You've built your first BroxiAI chatbot. Here's what to explore next:

Resources


Last updated