Conversation with Chatbot Agent

The Chatbot Conversation API is a powerful tool designed to enable developers to integrate chatbot functionalities into their applications.

This API allows seamless communication between a client application and a custom chatbot service agent, facilitating natural language processing and response generation.

Get your Chatbot Agent ID

A Chatbot Agent ID is gotten from the Autogon console after a successful creation of a chatbot agent, see here on how to create a Chatbot Agent.

Authentication

Requests to this API doesn't require an API Key to be included in its headers

Pricing

Requests made to the Chatbot Conversation API are billed. Each message - response cycle incurs a specific charge.

The pricing for API requests is as follows:

  • Per Request Cost: 0.05 units per API request

POST https://api.autogon.ai/api/v1/services/chatbot/{agent_id}/chat/

Initiates a new conversation session with the chatbot.

Path Parameters

NameTypeDescription

agent_id*

String

Unique identifier for the Agent which responds to the conversation.

Headers

NameTypeDescription

Content-Type*

String

application/json

Request Body

NameTypeDescription

question*

String

message from the user

session_id

String(UUID v4)

Identifier for the ongoing conversation session.


{
    "status": "true",
    "message": "Chat with agent: {agent_id} successful",
    "data": {
        "session_id": "cb6c2000-3231-47f1-b773-6f611bb1ea2f",
        "question": "hello chatbot",
        "bot_response": "How can I help you"
        }
}

Sample request

import requests
import json

url = "https://api.autogon.ai/api/v1/services/chatbot/test-agent-id-907e43cd56e7/chat/"

payload = json.dumps({
  "session_id": "test-session-id-1497505decbe",
  "question": "Hello Chatbot"
})
headers = {
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

Autogon Response

{
    "status": "true",
    "message": "Chat with agent: test-agent-id-907e43cd56e7 successful",
    "data": {
        "session_id": "test-session-id-1497505decbe",
        "question": "Hello Chatbot",
        "bot_response": "How can I help you"
        }
}

Last updated