Build your bot using ChatBot API

API Version

Chat with bot

This endpoint allows you to communicate with your bot and integrate the scenario with your website and application or even with your coffee machine.

Create user

Creates new user.

POST https://api.chatbot.com/users

Properties

parameter type required default
userId String(1, 256) required uuid
segments String(24), String[] optional
attributes Object(1, 99) required
attributes.<pattern> String(1,1024 optional
attributes.default_email String(1, 1024) optional null
attributes.default_name String(1, 256) optional null
attributes.default_url String(1, 1024) optional null
attributes.default_avatar String(1, 1024) optional null
attributes.default_language String(1, 1024) optional null
attributes.default_timezone String(1, 1024) optional null
attributes.default_gender String(1, 1024) optional null
attributes.default_ip String(1, 1024) optional null
attributes.default_city String(1, 1024) optional null
attributes.default_region String(1, 1024) optional null
attributes.default_country String(1, 1024) optional null
attributes.default_referrer String(1, 1024) optional null
attributes.default_username String(1, 1024) optional null

Note: userId is not required when attributes.default_email is provided

Request URL

curl --request POST \
	--url https://api.chatbot.com/users \
	--header 'authorization: Bearer ${DEVELOPER_ACCESS_TOKEN}' \
	--header 'content-type: application/json'

Response example

[
    {
      "id": "ID",
      "timestamp": "2018-01-19T11:55:07.552Z",
      "status": {
        "code": 200,
        "type": "success"
      }
    }
]

List users

Returns list of Users.

GET https://api.chatbot.com/users

Properties

parameter type required default
limit Number(1, 40) optional 40
after String(24) optional
sort Object optional
sort.field createdAt, lastSeen optional createdAt
sort.order asc, desc optional desc
match all, any optional all
filters Filter[1,5] optional

Request URL

curl --request GET \
	--url https://api.chatbot.com/users \
	--header 'authorization: Bearer ${DEVELOPER_ACCESS_TOKEN}'

Response example

{
    "data": [
        {
            "id": "5b7ff8476fcccc33c9249a8",
            "userId": "0735887f-6ba5-cccc-908e-6c84d093f317",
            "banned": false,
            "attributes": {
                "default_email": "joe@doe.com",
                "default_name": "Joe",
                "default_url": null,
                "default_avatar": null,
                "default_language": null,
                "default_timezone": null,
                "default_gender": null,
                "default_ip": null,
                "default_city": null,
                "default_region": null,
                "default_country": null,
                "default_referrer": null,
                "default_username": null
            },
            "conversations": 0,
            "createdAt": "2019-01-23 13:32:30.163Z",
            "lastSeen": "2019-01-23 13:32:30.163Z"
        }
    ],
    "count": 1
}

User object

parameter type
id String
userId String
banned Boolean
attributes Object
attributes.<pattern> String
attributes.default_email String, Null
attributes.default_name String, Null
attributes.default_url String, Null
attributes.default_avatar String, Null
attributes.default_language String, Null
attributes.default_timezone String, Null
attributes.default_gender String, Null
attributes.default_ip String, Null
attributes.default_city String, Null
attributes.default_region String, Null
attributes.default_country String, Null
attributes.default_referrer String, Null
attributes.default_username String, Null
conversations Number
createdAt String
lastSeen String

List single user

Lists single user details.

GET https://api.chatbot.com/users/:id

URL Params

Required: id=[alphanumeric]

Request URL

curl --request GET \
	--url https://api.chatbot.com/users/:id \
	--header 'authorization: Bearer ${DEVELOPER_ACCESS_TOKEN}'

Response example

    {
        "id": "5b7ff847cc3c3fb33c9249a8",
        "userId": "0735887f-6ba5-cccc-908e-6c84d093f317",
        "banned": false,
        "attributes": {
          "default_email": "joe@doe.com",
          "default_name": "Joe",
          "default_url": null,
          "default_avatar": null,
          "default_language": null,
          "default_timezone": null,
          "default_gender": null,
          "default_ip": null,
          "default_city": null,
          "default_region": null,
          "default_country": null,
          "default_referrer": null,
          "default_username": null
        },
      "sessionAttributes": {
        "group-selected": "14"
      },
      "conversations": [
        {
          "id": "5c486e62bda7873576a379e4",
          "date": "2019-01-23 13:32:30.163Z",
          "firstMessage": "hello"
        }
      ],
      "segments": [
        {
          "id": "5c46d514bda7873576a30c48",
          "name": "Leads"
        }
      ],
      "createdAt": "2019-01-23 13:32:30.163Z",
      "lastSeen": "2019-01-23 13:32:30.163Z"
    }

User details object

parameter type
id String
userId String
banned Boolean
attributes Object
attributes.<pattern> String
attributes.default_email String, Null
attributes.default_name String, Null
attributes.default_url String, Null
attributes.default_avatar String, Null
attributes.default_language String, Null
attributes.default_timezone String, Null
attributes.default_gender String, Null
attributes.default_ip String, Null
attributes.default_city String, Null
attributes.default_region String, Null
attributes.default_country String, Null
attributes.default_referrer String, Null
attributes.default_username String, Null
sessionAttributes Object
sessionAttributes.<pattern> String
conversations Object[Conversation]
segments Object[Segments]
createdAt String
lastSeen String

Conversation object

parameter type
id String
createdAt String
firstMessage String, Null

Segments object

parameter type
id String
name String

Update user

Update user basic data.

PUT https://api.chatbot.com/chat/me

Data Params

parameter type required
attributes Object(1, 99) required
attributes.<pattern> String(1,1024 optional
attributes.default_email String(1, 1024) optional
attributes.default_name String(1, 256) optional
attributes.default_url String(1, 1024) optional
attributes.default_id String(1, 1024) optional
attributes.default_avatar String(1, 1024) optional
attributes.default_language String(1, 1024) optional
attributes.default_timezone String(1, 1024) optional
attributes.default_gender String(1, 1024) optional
attributes.default_ip String(1, 1024) optional
attributes.default_city String(1, 1024) optional
attributes.default_country String(1, 1024) optional
attributes.default_referrer String(1, 1024) optional
attributes.default_real_name String(1, 1024) optional

Note: attributes properties are allowed with /^[\w-]{1,128}$/ pattern

Request URL

curl --request PUT \
	--url https://api.chatbot.com/chat/me \
	--header 'authorization: Bearer ${DEVELOPER_ACCESS_TOKEN}' \
	--header 'content-type: application/json' \
	--data '
    attributes.default_email="support@chatbot.com"
    attributes.default_name="ChatBot Support"
'

Response example

    {
      "timestamp": "2018-01-19T11:55:07.552Z",
      "status": {
        "code": 200,
        "type": "success"
      }
    }

Update session attributes

Update active session attributes.

PATCH https://api.chatbot.com/chat/me

Data Params

parameter type required
sessionId String(10, 64) required
attributes Object(1, 99) required
attributes.<pattern> String(1,1024 optional
attributes.default_email String(1, 1024) optional
attributes.default_name String(1, 256) optional
attributes.default_url String(1, 1024) optional
attributes.default_id String(1, 1024) optional
attributes.default_avatar String(1, 1024) optional
attributes.default_language String(1, 1024) optional
attributes.default_timezone String(1, 1024) optional
attributes.default_gender String(1, 1024) optional
attributes.default_ip String(1, 1024) optional
attributes.default_city String(1, 1024) optional
attributes.default_country String(1, 1024) optional
attributes.default_referrer String(1, 1024) optional
attributes.default_real_name String(1, 1024) optional

Request URL

curl --request PATCH \
	--url https://api.chatbot.com/chat/me \
	--header 'authorization: Bearer ${DEVELOPER_ACCESS_TOKEN}' \
	--header 'content-type: application/json' \
	--data '
    attributes.default_email="support@chatbot.com"
    attributes.default_name="ChatBot Support"
'

Response example

    {
      "timestamp": "2018-01-19T11:55:07.552Z",
      "status": {
        "code": 200,
        "type": "success"
      }
    }

Chat with bot

POST https://api.chatbot.com/chat

Data Params

parameter type required default
sessionId String(10, 64) required
query String(1, 256) optional
trigger String(1, 50) optional
goto String(24) optional
confidence Float(0.1, 1.0) optional 0.5
lifespan Number(1, 10) optional 2
reset Boolean optional false
storyId String(24) optional
parameters Object(0, 99) optional
parameters.<pattern> String(1, 1024) optional
debug Boolean optional false

Note:

  • at least one of query, trigger, goto is required
  • parameters properties are allowed with /^[\w-]{1,128}$/ pattern

Request URL

curl --request POST \
	--url https://api.chatbot.com/chat \
	--header 'authorization: Bearer ${DEVELOPER_ACCESS_TOKEN}' \
	--header 'content-type: application/json'

Response example

    {
      "result": {
        "source": "custom",
        "resolvedQuery": "text",
        "confidence": 0.7,
        "score": 1,
        "lifespan": 2,
        "incomplete": false,
        "storyId": "5b07fd67c2376e30306d9b0d",
        "interaction": {
          "id": "5b07ffafc2376e30306d9b16",
          "name": "text response",
          "action": ""
        },
        "parameters": {},
        "sessionParameters": {
          "default_email": "alexis.mcglynn77@hotmail.com",
          "default_name": "Alexis",
          "default_url": null,
          "default_id": null,
          "default_avatar": null,
          "default_language": null,
          "default_timezone": null,
          "default_gender": null,
          "default_ip": null,
          "default_city": null,
          "default_country": null,
          "default_referrer": null,
          "default_real_name": null
        },
        "contexts": [
          {
            "id": "5b07ffafc2376e30306d9b16",
            "name": "text response",
            "action": "",
            "parameters": {}
          }
        ],
        "fulfillment": [
          {
            "type": "text",
            "delay": 2000,
            "message": "text response"
          }
        ]
      },
      "sessionId": "c6d4bc58-4947-4f82-9e0b-67b87c6dc2de",
      "timestamp": "2019-03-12T13:27:15.513Z",
      "status": {
        "code": 200,
        "type": "success"
      }
    }

Start a free ChatBot trial
and build your first chatbot today!

Free 14-day trial No credit card required

Discover our other products