Build your bot using ChatBot API

API Version

Talk 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.

Session lifetime

Sessions expire after ten minutes of inactivity, however, receiving a new message before the time’s up resets the session to its initial duration.

Send a message

Send a message to your bot.

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

Request URL

curl --request POST \
	--url https://api.chatbot.com/query \
	--header 'authorization: Bearer ${DEVELOPER_ACCESS_TOKEN}' \
	--header 'content-type: application/json' \
	--data '
    {
        "query": "Hello",
        "sessionId": "1034021451"
    }
'

What is sessionID?

Session ID is used to identify the conversation between bot and client and should be generated on your side.

Properties

Properties query, goto, trigger they cannot be sent in one request together. Only one of them can occur in a single query to the bot.

Property Type Description
query String Your message.

String(1, 256)
sessionId String Required. Session ID is used to identify the conversation between bot and client and should be generated on your side.

String(10, 36)
storyId String Your bot story id.

String(24)
goto String Interaction id. Go to allows you to jump your bot to provided interaction.

String(24)
confidence String Confidence Score is a threshold that determines what the lowest matching score acceptable to trigger an interaction is. Read more

Number(0, 1)
Example possible values: 0.5, 0.8, 1
lifespan String Lifespan is a the number of allowed unsuccessful matches. Read more

Number(1, 10)
trigger String Trigger the specific interaction by typing trigger name.

String(1, 50)
reset Boolean Reset the contexts of the conversation.
parameters Object Parameters object. Parameters allow you to send any attributes and use them in turn in the bot’s response.
debug Boolean Optional. In the debug mode you will be able to see in the result all the performed actions like go to interaction, webhooks etc.

Default value: false

parameters

Example

{
    "email": "support@chatbot.com",
    "name": "Dariusz Zabrzenski"
}

Response object properties

Property Type Description
result Object Object result for your request.
sessionId String Conversation session id.
timestamp String Time of request execution.
status String Status object for your request.

Trigger welcome interaction

Request URL

curl --request POST \
	--url https://api.chatbot.com/query \
	--header 'authorization: Bearer ${DEVELOPER_ACCESS_TOKEN}' \
	--header 'content-type: application/json' \
	--data '
    {
        "sessionId": "1034021451",
        "storyId": "5a5f5520698d03000748325e",
        "trigger": "welcome"
    }
'

Response Example

{
    "result": {
        "source": "custom",
        "resolvedQuery": "",
        "trigger": "welcome",
        "confidence": 0.7,
        "score": 1,
        "lifespan": 2,
        "incomplete": false,
        "storyId": "5a5f5520698d03000748325e",
        "interaction": {
            "id": "5a5f5520698d03000748325f",
            "name": "Welcome Interaction",
            "action": "default.welcome",
            "type": "welcome"
        },
        "parameters": {},
        "contexts": [
            {
                "type": "welcome",
                "name": "Welcome Interaction",
                "parameters": {}
            }
        ],
        "fulfillment": []
    },
    "sessionId": "1034021451",
    "timestamp": "2018-01-24T12:19:12.206Z",
    "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