GPT4Business
Admin DashboardCertified Program Registration
English
English
  • Getting Started
    • 👋Welcome
      • The Company
      • Why Is This Fantastic for Your Business?
    • ✨Quickstart
    • 👨‍🏫Glossary
    • 🚧Prompting
      • Useful prompts
    • FUNCTIONS
    • 👨‍💻How AI Agents Work
      • How to Build an AI Agent
    • 🎨AI Agent Dashboard
    • 📝Knowledge Base
    • 🧮AI Agent Settings
    • 🪟AI Chat Widget
    • 🎭Conversations
    • 👑MasterChat
    • 💉Integrations
      • Embed Chatbot on a Website
      • Facebook Messenger
      • WhatsApp
      • Instagram
      • Human Handoff for Integrations
      • Squarespace
      • Shopify
      • WIX
      • Wordpress
      • GHL
      • More Questions About Embedding Agents
      • Zapier App
    • 📒Leads
      • Overview of Lead Generation
      • Sending Lead Data to Zapier
      • Sending Lead Data to GHL
      • Sending Lead Data to Zoho CRM
    • 🔌APIs
      • Getting starter
      • Message AI Agent
      • Message AI Agent Q/A
      • User / Me
    • SUPPORT
    • ⛑️Troubleshooting
      • Debug mode
      • Multilingual Responses
      • Responses are too long
      • Clickable link in responses
    • 👔Office hours
    • 🔍FAQ
      • General
      • Localization
      • Data/Security
      • Technical Questions
      • Other
    • 🔐Security & Compliace
      • Data Privacy & Security Overview
      • GDPR Privacy Overview
      • Privacy Policy
      • Terms & Conditions
      • Data Processing Agreement
      • AI Model Data Usage
    • 🆘Need help?
    • 💲Pricing
      • Basic plan
      • Professional Plan
      • Master Plan
      • Consulting Services
      • Enterprise Solutions
    • NEWS
      • January 2025
        • The Dawn of a New Era: Stargate AI and the Golden Age of Innovation
        • The Future of Software: Agents and the Decline of SaaS
  • 💰Certified Partner program
    • Game Changer Program
    • How much I can make?
    • Application process
    • Q/A about the Program
Powered by GitBook

© 2025 YoloAI Technologies Inc.

On this page
  • Send a Message to AI Agent
  • API Endpoint
  • Request Headers
  • Request Body
  • Request Example
  • Response Example
  • Error Handling

Was this helpful?

  1. Getting Started
  2. APIs

Message AI Agent

Send a Message to AI Agent

You can interact with this API by sending a POST request. This allows you to send messages, receive replies, and more.


API Endpoint

The following endpoint/URL should be used in order to access this API:

https://admin.gpt4business.ai/en/chatbot/api/v1/message/

Request Headers

The API must have the following request headers:

Content-Type: application/json
Authorization: Token <Your-API-Token>

Request Body

The API requires the following parameters in the request body:

  • chatbot_uuid (Type: UUID, Required)

    Unique identifier (UUID) of the chatbot. You can find this UUID on the chatbot's detail page.


  • query (Type: String, Required)

    Message or query the user intends to send to the chatbot. Must be under 5000 characters.


  • user_key (Type: String, Required)

    A unique identifier/string, used to distinguish users interacting with the chatbot.


Request Example

Here's an example of the request:

PythonJavaScriptCurl/Shell

import requests

# Define the API endpoint
url = "https://admin.gpt4business.ai/en/chatbot/api/v1/message/"

# Set the headers for the request
headers = {
    'Authorization': 'Token <YOUR-API-TOKEN>',
    'Content-Type': 'application/json'
}

# Construct the data payload
data = {
    "chatbot_uuid": "12345678-1234-5678-1234-567812345678",
    "query": "Your message/string here.",
    "user_key": "Your message/string here.",
}

# Make the API request
response = requests.post(url, headers=headers, json=data)

# Check the response
if response.status_code == 200:
    print("response:", response.json().get('data'))
else:
    error_data = response.json()
    print("Error:", error_data.get('message', '') + error_data.get('error', ''))

Response Example

Here's an example of the response:

JSON

{
    "message": "AI Agent successfully answered.",
    "data": {
        "answer": "If you have a specific question or need assistance with something, please let me know and I`ll be happy to help.",
        "chat_id": 634
    }
}

Error Handling

It's essential to handle any non-200 status codes (e.g., 400, 404, 500) returned by the API. In the event of an error, the API will provide a structured response as shown below:

JSON

// Response when no token is provided
{
    "detail": "Authentication credentials were not provided."
}
        

JSON

// Response when API parameters are incorrect
{
    "message": "The provided parameters are not valid. Please check and try again.",
    "errors": {
        "chatbot_uuid": [
            "This field is required."
        ]
    }
}
                                    
PreviousGetting starterNextMessage AI Agent Q/A

Last updated 4 months ago

Was this helpful?

🔌