< img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=578402809390336&ev=PageView&noscript=1" /> REST APIs | Acobot

You are here

REST APIs

Overview

You need the following APIs if you're developing your own chat client.

API Method Description
usend get Sends a user message to Acobot server.
uget get Gets unread messages from Acobot server.
agents get Checks if any human agents are available.

The APIs require a pair of group ID and key. To find out your group ID and key, log in to Acobot and choose APIs tab for the group. Note this page requires group Administrator role.

usend

Sends user message to Acobot server.

URL

https://chat.acobot.ai/usend?key=[string]&uid=[string]&msg=[string]

Parameters

Parameter Type Requirement Description
key string Required Your group API key.
uid string Required Your end user identity, which is unique within the scope of your group.
msg string Required The user message to be sent to Acobot.

Return Values

A JSON object includes the following property. See also HTTP Status below.

Property Type Description
result string Always "OK".

uget

Gets messages sent by AI or human operator from Acobot server.

URL

https://chat.acobot.ai/uget?key=[string]&uid=[string]

Parameters

Parameter Type Requirement Description
key string Required Your group API key.
uid string Required End user identity, which is specified by your application and should be unique within the scope of your group.
instance string Optional The ID for the application or client used by the end user. The instance parameter ensures the correct communication with Acobot server where an end user uses multiple instances of application.

Return Values

A JSON array of message objects, each of which contains the following properties. See also HTTP Status below.

Property Type Description
id integer The message identity, which is equal to the timestamp of message creation, in UNIX microseconds.
by character The type of sender. 'b' means bot or AI; 'o' means human operator; 'u' means user; 'i' means invite message.
cnt string The contents of message from Acobot server.

agents

Checks if any human agents are available.

URL

https://chat.acobot.ai/agents?key=[string]

Parameters

Parameter Type Requirement Description
key string Required Your group API key.

Return Values

A JSON contains a result property.

Property Type Description
id string "on" if one or more human operators are available; "off" if none.

HTTP Status

The following HTTP status codes are applied to all of the APIs above.

Code Description Explanation
200 OK Operation successfully completed.
401 Unauthorized Invalid group ID or key.
402 Payment required Free trial expires or usage exceeds the maximum billing amount you set.