Обновление
Знак В : Зарегистрируйтесь : Блог : Поиск: Язык : Помогите :
Обновление Platinum сервис и сделать свой собственный дизайн 3D аватар
Bot Libre Forum

The Bot Libre chat bot web API

по admin опубликовано Jan 5 2014, 7:21

In addition to being able to embed your chat bots on your own website, and access them from any Android device, you can also access your chat bots through the Bot Libre web API. The web API gives you the advantage of having complete control of your bot's client interface.

You can use the web API to access your bot from your own website through JavaScript, PHP or any other language. You can also use the web API to create your own mobile application to access your bot, such as an Android or iOS application.

A web API, is a set of HTTP GET/POST URI's that allow sending and receiving of message data. When you browse a website, your browser makes a series of HTTP GET/POST requests to URIs that return HTML content. In a web service the URIs return XML or JSON data, instead of HTML content.

The BOT libre web API provides two REST APIs in one. The first is a set of HTTP GET URIs that take FORM data, and return XML data. The second set of API's take HTTP POST XML data, and return XML data. Most applications would use the XML POST API, but some application may choose to use the FORM GET API because of its simplicity. The APIs are identical other than their mechanism.

HTTP FORM GET API

  • http://www.botlibre.com/rest/botlibre/form-chat
  • http://www.botlibre.com/rest/botlibre/form-check-instance
  • http://www.botlibre.com/rest/botlibre/form-check-user
  • http://www.botlibre.com/rest/botlibre/form-get-all-instances

HTTP XML POST API

  • http://www.botlibre.com/rest/botlibre/post-chat
  • http://www.botlibre.com/rest/botlibre/check-instance
  • http://www.botlibre.com/rest/botlibre/check-user
  • http://www.botlibre.com/rest/botlibre/get-all-instances

form-chat

The form-chat API receives a chat message and returns the chat bot's reply as an XML document.

URI: http://www.botlibre.com/rest/botlibre/form-chat
Parameters: application, instance, user, password, token, conversation, message, emote, correction, offensive, disconnect, includeQuestion

Parameters

applicationREQUIRED: Your application ID.
instanceREQUIRED: The ID of the bot to chat with. The bot's name can also be used, but the ID is better as it is guaranteed to be unique.
userOPTIONAL: The ID of the user who is sending the message. The user must be registered with BOT libre. If not passed the user will be anonymous. The user is required if the bot is private. The user/password are only required on the first message.
passwordOPTIONAL: The password of the user who is sending the message. A token can also be used.
tokenOPTIONAL: The token of the user who is sending the message. A token can be obtained through check-user, and is valid until reset.
conversationOPTIONAL: The conversation ID for the current conversation. This must not be passed on the first message, but will be returned by the response, and should be used for all subsequent messages in the conversation.
messageOPTIONAL: The chat message to send to the bot. The message can be omitted if you wish the bot to start the conversation (if the bot has a greeting set). The message must be encoded in the URI.
emoteOPTIONAL: A emotion to tag the message with. This is one of LOVE, LIKE, DISLIKE, HATE, RAGE, ANGER, CALM, SERENE, ECSTATIC, HAPPY, SAD, CRYING, PANIC, AFRAID, CONFIDENT, COURAGEOUS, SURPRISE, BORED, LAUGHTER, SERIOUS.
correctionOPTIONAL: A boolean that defines the chat message is a correction to the bot's last answer.
offensiveOPTIONAL: A boolean that defines the bot's last answer as offensive. The message will be flagged for the bot's administrator to review.
disconnectOPTIONAL: A boolean that defines the end of the conversation.
includeQuestionOPTIONAL: A boolean that indicates the question should be included in the response.

FORM GET Example

XML POST Example

Example Result

form-check-instance

The form-check-instance API validates that a bot ID or name exists, and returns the bot's details.

URI: http://www.botlibre.com/rest/botlibre/form-check-instance
Parameters: application, instance, user, password, token

Parameters

applicationREQUIRED: Your application ID.
idREQUIRED: The ID of the bot to validate. The bot's name can also be used, but the ID is better as it is guaranteed to be unique.
nameREQUIRED: The name of the bot to validate. The bot's ID can also be used.
userOPTIONAL: The ID of the user. The user must be registered with BOT libre. If not passed the user will be anonymous. The user is required if the bot is private.
passwordOPTIONAL: The password of the user. A token can also be used.
tokenOPTIONAL: The token of the user. A token can be obtained through check-user, and is valid until reset.

FORM GET Example

XML POST Example

Example Result

form-check-user

The form-check-user API validates user, and returns the user's details.

URI: http://www.botlibre.com/rest/botlibre/form-check-user
Parameters: application, user, password, token

Parameters

applicationREQUIRED: Your application ID.
userREQUIRED: The ID of the user. The user must be registered with BOT libre. If not passed the user will be anonymous. The user is required if the bot is private.
passwordREQUIRED: The password of the user. A token can also be used.
tokenREQUIRED: The token of the user. A token can be obtained through check-user, and is valid until reset.

FORM GET Example

XML POST Example

Example Result

form-get-all-instances

The form-get-all-instances API queries the details for all bot instances.

URI: http://www.botlibre.com/rest/botlibre/form-get-all-instances
Parameters: application, tag, sort, user, password, token, filterPrivate.

Parameters

applicationREQUIRED: Your application ID.
userOPTIONAL: The ID of the user. The user must be registered with BOT libre. If not passed the user will be anonymous. The user is required to query private bots.
passwordOPTIONAL: The password of the user. A token can also be used.
tokenOPTIONAL: The token of the user. A token can be obtained through check-user, and is valid until reset.
tagOPTIONAL: The tag to filter the bots by.
sortOPTIONAL: The sort option for the query. One of "name", "date", "dailyConnects", "weeklyConnects", "monthlyConnects".
filterPrivateOPTIONAL: Set if only the user's private bots should be returned.

FORM GET Example

XML POST Example

Example Result

So, that is the basic web API. You can now build your own interface for your bot. You can use the API on your own website, or in your own mobile application.

For a complete Java code example of using the full API, refer to the SDK source code on BotLibre on GitHub.


by OfficialAnonymous posted Feb 17 2016, 17:02

Admin mind helping here need a twitter bot please


Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 926, today: 0, week: 7, month: 47

by admin posted Feb 17 2016, 17:05
See
http://www.botlibre.com/forum-post?id=5015

Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 927, today: 0, week: 5, month: 42

by حسين posted Apr 19 2016, 9:04
حطني مقرب وشارك بسسسرعة:-)

Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 805, today: 0, week: 6, month: 44

by admin posted Apr 19 2016, 11:49
Sorry, from Google translate I get "Htny nearest vshark bsssrh :-)"?

Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 745, today: 0, week: 7, month: 48

by chatbot posted May 3 2016, 18:20

I think "حطني مقرب وشارك بسسسرعة" means "Look how close and posted quickly."

Please help improve my translation.


Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 797, today: 0, week: 6, month: 59

by araboy posted May 12 2016, 17:34

hi

why form-get-all-instances dont work


Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 717, today: 0, week: 10, month: 50

by admin posted May 12 2016, 21:11
Ensure you are using your application id from your user page.

What error are you getting?

Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 755, today: 0, week: 6, month: 52

Идентификатор: 5873
Теги: blog, how to, api, mobile, android
Опубликовано: Jan 5 2014, 7:21
Обновлено: May 12 2016, 21:21
Ответы: 7
Вид: 18044, сегодня: 4, неделю: 86, месяц: 504
I'm sure
Flag graphic as offensive, or in violation of site rules