How to Add an AI Chatbot to Your Website Using a Simple REST API
Businesses of all sizes are looking for simple ways to add AI to their websites. One of the easiest and most useful ways to start is with a chatbot. A chatbot can answer common questions, guide customers, reduce repetitive support work, and stay available even when your team is offline.
With a simple AI API, you can connect a chatbot to your website, app, or internal tool without building a full AI system from scratch. In this post, we will show how it works, why it is useful, and a few real examples of how businesses can use it.
Why Use an AI Chatbot?
An AI chatbot can improve customer experience while saving time. Instead of making customers wait for email replies or phone support, the chatbot can instantly respond to many common questions.
- Answer product questions
- Explain business hours
- Provide shipping and return policy information
- Help customers choose the right service or product
- Handle basic support questions
- Assist visitors 24/7
For many businesses, this is one of the fastest ways to start using AI in a practical way.
What This API Does
This AI API allows your application to send a message and receive a generated response. That means you can connect it to a website chatbot, a support widget, an internal assistant, or even an automation workflow.
The request is simple. Your application sends a message to the API endpoint, and the response includes the AI-generated reply.
Example Request
POST https://api.alejandro7.com/data/chat
Content-Type: application/json
{
"message": "What are your business hours?"
}
Example Response
{
"model_instance_id": "google/gemma-3-4b",
"output": [
{
"type": "message",
"content": "Our business hours are Monday through Friday from 9 AM to 5 PM."
}
],
"stats": {
"input_tokens": 25,
"total_output_tokens": 17,
"reasoning_output_tokens": 0,
"tokens_per_second": 5.58,
"time_to_first_token_seconds": 1.387
},
"response_id": "resp_example"
}
The main value most developers will use is:
output[0].content
That is the text you display back to the customer in your chatbot UI.
Real Website Chatbot Use Cases
A chatbot becomes much more valuable when it is connected to a real business need. Here are some practical examples:
1. E-Commerce Product Questions
A visitor asks:
“Do you have this product in black?”
“Which size should I buy?”
“Is this item good for outdoor use?”
The chatbot can respond with a helpful answer and guide the customer toward buying.
2. Business Hours and Contact Information
A visitor asks:
“Are you open on Saturday?”
“What is your phone number?”
“How can I contact support?”
The chatbot can answer instantly without a staff member needing to step in.
3. Shipping and Return Policy Questions
A visitor asks:
“How long does shipping take?”
“Can I return an item after 14 days?”
“Do you ship internationally?”
These are some of the most common questions businesses receive, making them perfect for chatbot automation.
4. Service-Based Businesses
A local service business can use a chatbot to answer:
“What areas do you serve?”
“Do you provide free estimates?”
“Can I book an appointment?”
This is useful for plumbers, contractors, salons, repair companies, consultants, and many other service providers.
5. Internal Team Assistant
The same API can also be used inside an internal business tool. For example:
- Drafting customer replies
- Summarizing notes
- Helping staff answer repetitive questions
- Creating quick text for emails or support responses
Simple Python Example
Here is a basic Python example showing how an application can send a message and print the AI response:
import http.client
import json
conn = http.client.HTTPSConnection("api.alejandro7.com")
payload = json.dumps({
"message": "Write a short welcome message for a customer visiting our website."
})
headers = {
"Content-Type": "application/json"
}
conn.request("POST", "/data/chat", payload, headers)
res = conn.getresponse()
data = res.read().decode("utf-8")
print(data)
After parsing the JSON response, you would normally read:
output[0].content
That value can then be shown inside your chatbot or website widget.
Recommended Setup for a Website Chatbot
The safest and most professional way to use the API is to call it from your server, not directly from browser JavaScript. This helps protect your API credentials and gives you better control over validation, logging, and future customization.
A common setup looks like this:
- The website visitor types a message into the chatbox
- Your website sends that message to your server
- Your server sends the message to the AI API
- Your server receives the response
- The chatbot displays the reply to the visitor
This setup is ideal for websites, stores, customer portals, and web apps.
Examples of Chatbot Prompts Businesses Can Use
One of the best things about an AI API is that it can be used for many different types of chatbot conversations. Here are a few examples businesses can use right away:
Customer Support Prompt
{
"message": "A customer is asking if we are open on weekends. Write a short friendly reply."
}
Product Recommendation Prompt
{
"message": "A customer wants help choosing between two laptop bags for travel. Write a helpful response."
}
Lead Qualification Prompt
{
"message": "Ask the visitor what type of service they need, their budget, and their preferred timeline."
}
Appointment Chat Prompt
{
"message": "Write a short message asking the customer what day and time they want to book."
}
These examples can be adapted for retail stores, local services, agencies, e-commerce, or internal tools.
Why Businesses Like This Approach
- Fast to integrate
- No need to host your own AI model
- Useful for websites, apps, and automation
- Simple JSON request and response format
- Flexible enough for many business use cases
Instead of spending weeks building a custom AI system, businesses can start with one endpoint and begin testing real use cases quickly.
Final Thoughts
An AI chatbot is one of the most practical ways to bring AI into a business website. It can answer questions, improve response times, reduce repetitive work, and create a better experience for visitors.
Whether you want to build a support assistant, product helper, lead capture chatbot, or internal business tool, a simple AI API gives you a fast starting point.
If you want to add AI chat to your website, app, or workflow, this kind of API makes it easy to get started without unnecessary complexity.
Need AI API access for your website or chatbot project?
Request access and start building AI chat, assistants, and automation into your business tools.
Need Help? https://alejandro7.com/