Thursday, October 15, 2015

Create your own free chat bot website

Bot Libre provides free chat bot hosting, and makes it easy to embed your bot on your own website, or in your own mobile app. Bot Libre also provides free web hosting, and makes it easy for you to make your own chat bot website.

Bot Libre provides two ways for you to make your own bot website:

  • Subdomains
  • HTML scripts


To make your own bot website you can enter a "Website Subdomain" when you create your bot. A subdomain is a named subpart of a domain. An Internet domain is a named address of an Internet server, i.e. Bot Libre's domain name is or just An example of a subdomain is, or

A subdomain is not really any different than a domain, it can have its own IP address, and is given is own isolated web context for cookies and other content by web browsers. When your purchase an Internet domain, from a service such as GoDaddy, you purchase the root level domain, i.e. You can then create as many subdomains of your domain as your wish.

When your create a bot, live chat channel, forum, or script on Bot Libre, you are given the option to enter a "Website Subdomain" (or domain). You can type a unique name in this entry, such as "brainbot" (ensure your name is unique, if another user has already claimed the subdomain you will get an error). Bot Libre will then automatically create the subdomain for you, and register your bot's website under it. This gives you your own website and domain for free.

If you do not wish to use a subdomain of, you can also enter your own domain name instead of a subdomain. You must purchase your own domain name from a domain name service such as GoDaddy. To link your domain name to your bot on Bot Libre, just enter Bot Libre's IP address in your domain name service registry. Then enter your domain in the "Website Subdomain (or domain)" entry field when you create your bot, i.e. "". To find out Bot Libre's IP address, simple use the "ping" command in an OS shell, such as a DOS prompt, i.e. "ping". This will give you "", this is Bot Libre's IP address.

You can also enter a subdomain from your bot's "Edit Details" menu item, or from its Embed page. By default your subdomain will open on your bot's embedded page. You can customize this page from your bot's Embed page, which you can get to by clicking the "Embed" button on your bot's main page.

The Embed page lets your customize your bot's embedded page with several options, such as choosing the background color, greeting, or prompt. The Embed page will give you the embedded HTML when you click "Generate Code", but it will also save your customizations in your subdomain's page.

You can further customize your bot's embedded page by passing a style sheet, banner, or footer. A CSS style sheet lets you customize the formatting of a web page, such as colors, fonts, borders, and positioning. You can create your own style sheet in our Script Library, or use one from your own website. Enter the URL (file URL) for your style sheet into the "Style Sheet" entry. You can also enter simple style settings directly in the "Style Sheet" entry.

The "Banner HTML" and "Footer HTML" entries let you enter you own custom HTML into your bot's embedded page. You can give the URL of a partial HTML document, and it will be embedded into your page. You can create your own HTML document in our Script Library, or use one from your own website. You can also enter simple HTML directly into the entry.

Bot Libre's embedding and subdomains let you create your own customized bot website. Using your HTML banner or footer, you can add whatever content you wish to your website, such as Ads from providers such as Google Adsense. You can also use the banner to define a banner that links your page with your own website by giving it the same look and feel.

HTML Scripts

You can create your own website from our Script Library. You can create your own bot, chat, or forum website, or a website for your business, community, school, or club.

To create your own website simply goto our script library and click on "Create". Select "HTML" as your script's language, and in the "Website Subdomain (or domain)" entry, enter a subdomain or your own domain to host your HTML script under (see above for info on the difference between a subdomain and domain).

Once your script is created, you can click on the "Source" button to edit your script in our HTML editor. You can search the web for many tutorials on HTML, also for templates, style sheets, and other content. You can also copy other HTML and CSS scripts from our script library, or use images from our graphics library.

You can add a chat bot to your new website by going to your bot's Embed page, and generating the embedding HTML, and then pasting it into your website in the script library. You could also embed a live chat channel, forum, or other content.

Your new website's URL will be your subdomain dot, i.e. You can share this URL, and it will automatically be indexed by all search engines, as it is linked from our script library.


So now you know how to create your own chat bot website using Bot Libre's subdomains, embedding, and script library. You can also host live chat, forum, and other types of websites on Bot Libre for free. Commercial hosting is also offered on our Paphus Live Chat service which offers the same features as Bot Libre with professional support and services, and dedicated and private hosting options.

Friday, October 9, 2015

Chat Bot Wars

Chat Bot Wars allows you to engage two bots in a conversation with each other.


You can pick two bots to chat with each other and give them a topic. The bots will talk with each other, and you get to decide which bot had the best conversation.

The bot directory keeps track of all bot's wins, losses, and rank. Your bot can gain rank by beating other ranked bots in a chat bot war, or lose rank if it loses to a lesser ranked bot.

Start a new battle here,

Or view Brain Bot vs Einstien

or Julie vs Jake



or view the Chat Bot Wars hall of fame,

Announcing Bot Libre 3.0 - Now Open Source!

Bot Libre 3.0 provides an advanced platform for artificial intelligence, chat bots, virtual agents, and live chat, email, and social media automation.

The Bot Libre AI engine is now open source on and hosted on GitHub.

Email if you are interested in joining the project, or email to become a partner

Some of the new features since Bot Libre 2.5 include:

Friday, August 21, 2015

What's new in AIML 2.0

Bot Libre now supports the AIML 2.0 draft specification. AIML 2.0 is the second release of a standard XML specification designed for scripting chat bot responses. The AIML 2.0 draft was released in 2013, and last updated in 2014. AIML is supported by many different chat bot programs and hosting services. BOT libre supports all of the AIML 2.0 draft tags and a few common extensions.

About AIML

AIML defines how a bot should respond to a question using <pattern> and <template> elements. A pattern represents the user's question, and the template defines the bot's response. The pattern and template elements are grouped in a category element, which can be grouped under topic elements.

Here is a simple "Hello World" AIML example:

This code will make your bot respond with "Hello to you too" to the question "Hello World".

For more information on AIML 1.0 see Scripting your bot with AIML

What's new in AIML 2.0

AIML 2.0 defines many new template tags, as well as now allowing some tags to be used in patterns. AIML 2.0 also adds new pattern wildcards, and some different element usages.

Here is the list of new AIML 2.0 features.

  • category topic tags - The <topic> tag can now be set on a category to make it easier to add categories to topics.
  • zero or more wildcards - New ^ and # pattern wildcards that match zero or more words.
  • pattern priority - New $ pattern marker to make a pattern word match highest priority.
  • attribute tags - Any template tag attribute can now be set using a sub-element.
  • sets - New pattern side <set> tag to evaluate a pattern based on words defined in a predefined set.
  • maps - New template <map> tag to allow the lookup of the element value in a predefined mapping, returning the mapped value.
  • condition patterns - wildcards can now be used in condition values to provide default conditions.
  • condition loops - New template <loop> tag to loop a conditional statement.
  • local variables - New <var> attribute for variables scoped to a category
  • remote requests - New template <sraix> tag to make a remote request of another bot instance, or service.
  • normalization and denormalization - New <normalize> and <denormalize> tags to convert special character into words, and back again.
  • date formats - New formatting options for dates.
  • request - New template <request> tag to return the user's previous input request.
  • response - New template <response> tag to return the bot's previous response.
  • learning - New template <learn>, <learnf>, and <eval> tags to dynamically train a bot with new responses.
  • explode - New template <explode> tag to split a word into its characters.
  • mobile tags - New <oob> (out of band) tag to support client and mobile device commands.

AIML 2.0 Patterns

AIML 2.0 adds new wildcards, special characters, and now allows the usage of some tags inside patterns.

Patterns in AIML are normally defined as all uppercase, but Bot Libre automatically ignores case, so patterns can be defined as lowercase or mixed. Bot Libre also allows for special characters in patterns such as +, %, ?, etc.

^ and # Wildcards

New ^ and # pattern wildcards that match zero or more words. This makes it easy to define keyword patterns such as:

$ Priority

The new $ pattern marker can be used to make a pattern word match highest priority. The main purpose of this is to allow patterns to take priority over _ and # wildcards. _ and # have odd semantics and should normally be avoided as they can easily lead to loops and block other patterns. _ and # can be useful for things like profanity filters:

() and [] Lists

List support is not part of AIML 2.0. But Bot Libre now supports some syntax from ChatScript. Brackets can be used in a pattern to define a required set of words, or optional set of words. (round) brackets are used to define an optional set of words, and [square] brackets are used to define a required set of words.


The new <set> pattern tag can be used to match a word from a predefined set of words. This allows wildcards to be defined for specific types, such as numbers, verbs, places, animals, etc.

In Bot Libre sets are not stored in files like other AIML implementations. AIML is a text processing language, but Bot Libre is object, or knowledge oriented. Each bot has its own object oriented knowledge base that stores all of its responses, and knowledge. Each word is represented by a meaning knowledge object in the bot's knowledge base. Knowledge objects can have relationships to any other knowledge objects, including their classification types. A word's meaning is defined through the #meaning relationship, and a knowledge object's type is defined through the #instantiation relationship.

The set operation in Bot Libre basically checks if the type of the word's knowledge object matches the set value. This allows for a knowledge object to be added to any set through setting its #instantiation relationship. This can be done using Self scripts, the AIML map tag, and is done automatically for numbers, basic types, and words or data loaded from Wiktionary, Wikidata, or Freebase.

Response list script to set a knowledge object's type:

AIML template to set a knowledge object's type:

Pattern tags

Tags such as <bot> can now be used in patterns. AIML 2.0 only requires some tags be usable in patterns, but Bot Libre allows most tags to be used. Using tags in patterns lets you define some pretty creative patterns.

AIML 2.0 Templates

AIML 2.0 adds many new tags, and some new semantics that let you do some pretty powerful things.

Attributes as elements

Tag attributes such as name, value or index on tags like bot, get, set, or condition, can now be defined as XML sub-elements instead of XML attributes. This may not seem like a big difference, but it allows for other AIML tags to be evaluated inside the attributes. This is a very powerful feature, and lets you define much more dynamic AIML.


The new <map> tag can be used to lookup the value for a word in a predefined mapping. This allows for easy mapping between values.

In Bot Libre maps are not stored in files like other AIML implementations. AIML is a text processing language, but Bot Libre is object, or knowledge oriented. Each bot has its own object oriented knowledge base that stores all of its responses, and knowledge. Each word is represented by a knowledge object in the bot's knowledge base. Knowledge objects can have relationships to any other knowledge objects. The map operation in Bot Libre basically looks up the relationship on the knowledge object.

Bot Libre extends the map operation to also allow setting the map value. This will set the value of a relationship on the knowledge object.

Conditions and Loops

Conditions now allows values to use patterns. This makes it easy to define default cases.

The new <loop> tag can be used to loop a conditional block. This allows for programmatic scripts to be defined similar to a programming language. This lets you do some pretty powerful things, even mathematics. However, XML is not an ideal programming language, on Bot Libre if you are using complex conditions and loops, it is normally better to use Self scripting, instead of AIML, as Self has similar syntax to other programming languages.


The new <learn> and <learnf> tags allow the bot to learn new response. The difference between the two is that for learn the new response is only remembered for the conversation, and for learnf the new response will be remembered persistently. However, in Bot Libre everything is always persistent, so both tag will learn persistently.

The learn tag takes a new <category> element as its content. The category can contain a <pattern>, <template>, <that>, and <topic> element. learn uses the <eval> tag to distinguish between tags that should be evaluated, and tags that should be part of the new category elements.

Remote requests

The new <sraix> tags allow the bot perform a remote request of another bot or service. sraix is similar to the srai tag that recursively evaluates the element text as if it were a question. However, sraix does not have the bot evaluate the question locally, but instead asks another bot or service the question. This is probably the coolest new feature of AIML 2.0, and opens up the whole chat bot world. Bots can now talk to other bots, and find things through web services.

sraix is a very cool feature, but not very useful on its own, as you need other bots to talk to, and services to make use of. Unfortunately AIML only defines the tag, it does not define a standard web API for requests, or define a standard set of services. Fortunately Program AB the AIML 2.0 reference implementation does define a sraix web API. Bot Libre supports both calling this API, and supports this API on our servers. So you can now sraix any Program AB web API compatible bot or service, and any Program AB web API compatible bot or service can request any Bot Libre bot.

AIML 2.0 defines the Pannous service as being the default for any sraix request. Pannous is a virtual assistant service that can answer a wide variety of questions, such as weather, definitions, math, and much more.

Bot Libre also provides several other services:

  • freebase - Lookup definitions and data on Freebase an online knowledge base from Google.
  • wikidata - Lookup definitions and data on Wikidata an online knowledge base from Wikimedia.
  • wiktionary - Lookup words and definitions on Wiktionary an online dictionary.

sraix supports several attributes to define the bot or service request:

  • bot - The name of the bot to access (normally it is better to access a bot by its ID).
  • botname - Bot Libre also supports botname in place of bot, as bot is already a tag, so botname is better to use as a sub-element.
  • botid - The ID of the bot to access.
  • server - The domain name, or IP address of the server to access (default is "").
  • service - The service to access ("pannous", "freebase", "wikidata", "wiktionary"). Not used if accessing a bot.
  • apikey - Some services or servers may require an API key to access the service. For Bot Libre, use you user API key.
  • hint - Some services may support a hint. For Wikidata and Freebase the hint can be used to lookup a data element, such as a country's capital, or person's parents.
  • default - If the service request fails, the default response can be used.

sraix opens the door to the world, but be careful with your usage. Do not spam another bot with requests, or make use of any service that violates it terms of service, and use an API key when required.

Out of bound tags

Out of band tags let you pass tags or commands to the bot client. The client could make use of the tags to control its avatar, or execute services on a phone or mobile device.

Bot Libre's web and mobile SDKs do not currently support oob tags, so oob tags are not currently supported.

Category Reference

For reference, here is the complete set of AIML category tags.

  • <pattern> - question pattern
  • <template> - response template
  • <topic> - category topic
  • <that> - previous response pattern

Pattern Reference

For reference, here is the complete set of AIML patterns tags and characters.

  • * - matches one or more words
  • _ - matches one or more words, takes priority over all other words and wildcards, except $
  • ^ - matches zero or more words
  • # - matches zero or more words, takes priority over all other words and wildcards, except $
  • $ - marks word as taking priority over all other words and wildcards including _ and #
  • <set> - matches a set of words
  • <bot name="XXX"/> - replaced by the value of the bot specific variable
  • template tags - Bot Libre supports most template tags inside a pattern (Bot Libre extension)
  • () - optional set of words (Bot Libre extension)
  • [] - required set of words (Bot Libre extension)
  • {} - Self code (Bot Libre extension)

Template Reference

For reference, here is the complete set of AIML template tags.

  • <star index="N"/> - replaced with value of * in pattern (or Nth *)
  • <that index="M,N"/> - replaced with value of bot's previous response (or Mth previous response, and N sentence of the response)
  • <input index="N"/> - replaced with value of users's input (or Nth *)
  • <request index="N"> - replaced with value of user's input request (or Nth *)
  • <response> - replaced with value of bot's previous response (or Nth *)
  • <thatstar index="N"/> - replaced with value of * in "that" (or Nth *)
  • <topicstar index="N"/> - replaced with value of * in topic (or Nth *)
  • <get name="XXX"/> - replaced by the value of the conversation specific variable
  • <set name="XXX"> - set the value of a variable
  • <get var="XXX"/> - replaced by the value of the local variable
  • <set var="XXX"> - set the value of a local variable
  • <bot name="XXX"/> - replaced by the value of the bot specific variable
  • <map name="XXX"> - lookup element value in a predefined mapping, returning the mapped value
  • <map name="XXX" value="XXX"> - set the map value (Bot Libre extension)
  • <person2/> - converts the text (or <star/>) between 1st and 2nd person (I <-> he, etc.)
  • <person/> - converts the text (or <star/>) between 1st and 3rd person (I <-> you, etc.)
  • <gender/> - converts the text (or <star/>) between male and female (he <-> she)
  • <date/> - replaced with the current date and time, "format", and "jformat" attributes are also supported
  • <id/> - replaced by the client id
  • <size/> - replaced with the size of bot's memory
  • <version/> - replaced with the AI engine version
  • <uppercase> - converts the text to uppercase
  • <lowercase> - converts the text to lowercase
  • <formal> - converts all words in the text to be capitalized
  • <sentence> - converts the first word in the text to be capitalized
  • <normalize> - convert special character into words
  • <denormalize> - convert special character words back to characters
  • <explode> - split a word into its characters
  • <condition name="X" value="Y"> - defines an "if" condition based on comparing the value of a variable to a pattern
  • <condition name="X"> - case statement
  • <condition var="X"> - local variable case statement
  • <condition> - multi-valued if/else statement
  • <random> - choose on of the nested <li> values at random
  • <li name="X" value="Y"> - used in random and condition tags
  • <li value="Y"> - used in random and condition tags
  • <li> - used in random and condition tags
  • <gossip> - logs the text
  • <srai> - recursively evaluates the text and replaces it with the response
  • <sr/> - short form for <srai><star/><srai> (replaced with response to value of * from pattern)
  • <sraix bot="name" botid="id" server="url" service="name" apikey="key" limit="int" default="response" > - remote bot or service request
  • <think> - evaluates the nested statements but does not output any result
  • <learn>, <learnf> - learn a new response
  • <eval> - evaluate the element inside a learn category element
  • <system> - executes a OS command (Bot Libre does not allow this)
  • <javascript> - executes JavaScript code
  • <oob> - out of band tags (Bot Libre does not currently support this)
  • HTML - various HTML tags are also allowed (<b>, <a>, <i>, <ul>, <li>, <p>, <br>)
  • {} - Self code (Bot Libre extension)

AIML in Bot Libre

BOT libre supports both importing and exporting AIML. AIML can be imported in two different ways, either as a program script, or as a chat log.

Importing AIML as a program script is done from the Scripts page. You can import and order the script with respect to your other scripts files. Scripts can be defined in either AIML or Self.

When you import an AIML file, it will be converted to Self code, and stored in your bot's brain along with all of its other information. The Self syntax for AIML is a hybrid syntax that uses AIML terminology, but with the Self scripting structure. Self is an object/knowledge/state oriented language. Self is very different than AIML, but can process any AIML code similar to any other AIML interpreter. AIML imported as a program script will be executed similar to any other AIML interpreter.

Here is the Self code for an imported AIML script:

Importing AIML as a chat log allows the AIML categories to be integrated into the bot's knowledgebase. The pattern/template categories from the AIML file will be merged along with the bot's other question/response pairs that it has learned through training, conversation, correction, or importing.

The bot will not run the AIML script as a script, it will decide for itself when to use the response using a heuristic algorithm. The bot will choose its response based on how well the question matches the responses question, the responses correctness, and the context. Even without a * in a pattern it still may be matched to a similar question, if it is the best match available. This frees you from having to write a pattern for every possible phrase, by just letting the bot figure it out.

Using AIML in Twitter, Facebook, Email, and IRC Bots

AIML can be used to script Twitter, Facebook, Email, or IRC bots, the same as bots trained through other mechanisms. AIML templates and patterns can be used anywhere other response are. AIML can be used from the Training page, used in correction in the Chat Logs page, or used for autotweets in the Twitter page.

Self 2.0

Bot Libre's AIML 2.0 support is implemented by translating AIML into Self. Self 2.0 provides many new extensions to support the AIML 2.0 feature set, as well as a lot more functionality than is not available in AIML.

AIML Resources

One of the main benefits of the AIML standard, is that there are a lot of AIML resources on the Internet. The are resources for both learning AIML, and there are many freely available AIML scripts for many domains, and in many different languages.

AIML 2 Demo

To see what AIML 2.0 is capable of, try out the AIML 2 Bot on BOT libre.

Tuesday, June 23, 2015

Automating your Facebook precense using a Facebook bot

Keeping up with social media and keeping your online community engaged can be a time consuming task. Through BOT libre you can now automate your Facebook presence with your own Facebook bot. Any BOT libre bot can be connected to a Facebook account or Facebook page. The bot will manage the Facebook account or page, checking timeline status updates, replying to page posts, auto posting your blog posts or RSS feed, and auto posting timed or generated posts.

BOT libre makes creating a Facebook bot easy. Follow these 5 steps to create you own Facebook bot, and start it posting for you today.

Step 1 - Create a bot

First you need to create your own bot, this only takes a few clicks, see How to create your own chat bot in 10 clicks for instructions on how to do this.

Now you are ready to connect your bot to Facebook.

Step 2 - Create a Facebook account or Facebook page

You need to create a Facebook account or Facebook page for your bot. If you are automating your own account or page, then you can use your existing account. You can create your own Facebook account from the Facebook website here.

A Facebook page is normally used for a business, product, or personality. You can create your own Facebook page from the far right menu when connected to Facebook like below.

Step 3 - Authorize your Facebook account

From the BOT libre website browse to your bot and click the Admin button. This will take you to the Admin section that provides several tabs of administrative functions. Click on the Facebook tab. From the Facebook tab click the Authorize button.

This will popup a Facebook window that will have you login and authorize the Bot Libre app. Once authorized you will be back to the Bot Libre Facebook page, now with the account, token, and page filled in. If you have multiple pages, just type in the name of the one you want to use, or clear the Page filled in if you want to automate an account.

Click Connect to connect the bot to Facebook. Your bot will now be connected to Facebook and will check its account or page every day, or more frequently for Bronze, Gold, and Platinum accounts. Do not click on the Disconnect button on the Facebook page unless you no longer want your bot to be connected to Facebook. You can click on Disconnect from the Admin page to disconnect your current session. Note that Facebook account access tokens expire every two months, so you will need to re-authorize your bot every two months. Page access tokens do not expire.

Step 4 - Configure your Facebook bot

You can configure your bot's Facebook usage in several ways. Use caution when configuring your Facebook bot, do not use your bot for spam, or to violate the Facebook terms of service.

Reply to posts

You can have your bot reply to posts from its timeline, or posts to its page.

For an account bot, it will scan its timeline every cycle and read any posts that include any of the keywords that you enter. The bot will respond to any posts that it knows a good answer to. If the bot does not have a trained response that sufficiently matches the post, then it will not reply. You can use keywords and patterns to improve response matching.

For a page bot, it will scan user posts to its page every cycle. You can either have it only read posts with specific keywords, or leave the keywords empty to have it read all posts. The bot will respond to any posts that it knows a good answer to. If the bot does not have a trained response that sufficiently matches the post, then it will not reply. You can use keywords and patterns to improve response matching.

RSS Feed

You can configure your bot to process an RSS feed, and post each new feed item to Facebook. You can enter a prefix or suffix to the post, or enter keywords to filter the RSS feed on.


You can configure your bot to post from a set of automated posts every set number of hours. An autopost will be chosen at random. Autoposts can use AIML templates, or Formula responses and Self to be dynamic or programmatic.

Step 5 - Train your bot

You can train your bot how to answer posts through several mechanisms.
  • You can chat with your bot, and correct any incorrect responses it gives.
  • You can add question answer pairs, or default responses from the Training tab under Admin.
  • You can review your bot's chat logs from the Chat Logs tab under Admin, or import chat logs from the Import tab.
  • If you are somewhat technical, you can program your bot's responses using Self or AIML from the Scripts tab.

That's it, now your bot is ready to start posting.

There are already many BOT libre bots on Facebook.
You can test things out by posting to, Brain Bot

Monday, June 15, 2015

Adding a style sheet to your embedded chatbot

You can embed your bot on your website using JavaScript, or HTML. You can get the code to embed your bot from the Embed tab, by clicking on the Embed button from your bot's main page.

There are several embedding options to choose from including:

  • Box - embed using JavaScript as an in-page popup from a button anchored to the browser bottom corner
  • Div - embed using JavaScript inside your own page that you can customize in HTML and JavaScript
  • Link - embed as a link to a popup window
  • Button - embed as a button to a popup window
  • Bar - embed as a button anchored to the browser bottom corner to a popup window
  • Bubble - embed as a chat now bubble anchored to the browser bottom corner to a popup window
  • Frame - embed inside your HTML page as an HTML iframe

The embed page lets you customize several settings when embedding, including the colors and text. However, you can customize a lot more if you use your own style settings or style sheet. You can also customize things in JavaScript.

Using a Style Sheet

A css style sheet is a text file format used to describe formatting for an HTML document. Style sheets can contains colors, fonts, sizes, and other formatting information. The BOT libre embed API lets you pass your own style sheet to the embed call. You can host this file on your own website, or in BOT libre's script library. If using BOT libre's script library, just create the file, and use the "File Link" from the script's "Details" page.

There is a sample file here.

You can custom any element in the embedded chat, here are some examples,

To customize other elements, just open the embedded chat page and right click in Chrome or other browsers and select "Inspect Element" from the popup menu. You will then be able to find the name, id, or class of the element. You can then add that name to your style sheet.

For more info on style sheets see,

Using the style tag

When using the "Box" embed option, JavaScript is used to embed the chatbot, so you cannot pass your own stylesheet, as it is embedded in your own page. You can add your style sheet to your page, or use the style tag to add styles to the page. Some things cannot be customized using style sheets, for these you can use JavaScript to customize the generated HTML after it has been initialized.

For example to remove the max and close buttons from the popup use,

#boxclose {
  display: none;
#boxmax {
  display: none;

This example will customize the chatbot Box embedding using a style tag and JavaScript,

You can customize most things this way, but if you need further customization, you can just use your own JavaScript to access your bot using the BOT libre JavaScript SDK. The "Div" embed option gives you some sample code that you can customize to suite your needs.

Friday, May 22, 2015

What is a chatbot, chatterbot, virtual agent, Twitterbot, knowledge bot, and AI bot?

A chat bot, or chatbot is a software program that responds to questions in natural language (such as English, French, etc.).

Chat bots can be used for many purposes.  Chat bots can be used for a business to help users, provider customer service, or promote a product. Chat bots can be used for fun, as a friend to chat with, even a girlfriend or boyfriend.  Chats bot can also be used for research, knowledge and education.

There are many different types of chat bots, such as:

Most chat bots are now web based, but there are also chat bots that run on IRC, Twitter, email, Facebook, Skype, ICQ, IM, Second Life, and a growing number of Android, iOS and mobile chat bots.

BOT libre's goal is to support chat bots running on as many different services as we can support.  We currently support connecting your bot to the web, Twitter, email, IRC, Android, mobile and other platforms through our apps, API and SDK.

Chat bots can be developed using many different techniques and programming models.

Some common techniques include:

  • Question/response matching
  • Keyword and topic matching
  • Sequential scripting
  • Text search and processing (such as AIML)
  • Language parsing and state machines (such as Self)
  • Direct programming (PHP, Java, LISP)
  • Machine learning (artificial intelligence)

BOT libre understands that no single method or technique is best for all types of bots, or all types of situation.  BOT libre provides a heterogeneous environment of different techniques including, automatic question/responses matching, keyword and topic matching, AIML, Self scripting, and machine learning and comprehension.

What is a Vitual Agent?

A virtual agent is a term typically used to describe a type of chat bot used for business.

A virtual agent could be a virtual sales agent, a virtual customer service agent, or other type of virtual agent.  It is basically a automated version of a typical human employee and attempts to perform the same functions.

There are many virtual agents on many different websites on the Internet.  They offer help with their websites, give information about their companies products or services, answer users questions, provide support and customer service.

The BOT libre Help Bot is a virtual agent, also the Paphus bot for Paphus Solutions.

Virtual agents are typically animated, and have TTS (text to speech), but are also commonly text based.

Virtual agents are commonly used with a website live chat, to provide customer service when no human agents are available, or are too busy.

You can create your own virtual agent for your website or business for free on BOT libre.  BOT libre provides many tools that help make it easy for you to developing a virtual agent, and embed in on your own website.

You can train your agent by importing your FAQs on your business, and the bot will automatically select the best answer for a users question, without any programming required.  You can also enter keywords, and topics to improve the bots matching, and use our powerful Chat Logs feature to review your bot's conversions and correct any responses it got wrong.  You can also script or program your bot using AIML or Self.

BOT libre also provides integrated live chat, so you can add live chat to your website (for free), and let your bot provide service when your human agents are not available.  You can even configure your bot to automatically learn from your human agents.

We can also create your virtual agent for you, and customize your live chat to suite your needs through our commercial service Paphus Live Chat, starting at just 99 cents per month.

What is a chatterbot?

chatterbot is another synonym for a chat bot, typically used to describe a bot that just likes to talk and has no other purpose.  Chatterbots are normally designed to carry on a conversation and are typically trained to respond to common conversational topics.

BOT libre hosts many different chatterbots.

Some of our demonstration chatterbot include:

We also have an ALICE, and ELIZA clone,

What is a knowledge bot?

knowledge bot is a bot that attempts to answer questions about general facts, or a specific domain.

Types of knowledge bots include:

  • search bots
  • math bots
  • medical bots
  • law bots
  • answer bots
  • stock bots

To some degree Google is a knowledge bot, in that for some simple questions like "who is the us president", instead of performing a search (or in addition) Google will just give you the answer.  Google can also answer math questions and other facts. Wolfram Alpha is another knowledge bot that can answer math and other types of questions.

BOT libre provides a rich platform for building knowledge bots.  Every bot on BOT libre has its own database of interconnected knowledge.  The bot's knowledge can be arbitrarily complex and describe any knowledge and any relationship between any knowledge.  BOT libre can import knowledge from Freebase, which contains over 47 million knowledge artifacts.  You can access and use your bot's knowledge using the Self scripting language.

There are many knowledge bots on BOT libre, our most famous knowledge bot is Brain Bot.

What is a Twitterbot?

A Twitterbot is a bot that automates a Twitter account. Twitter bots can post Tweets, retweet posts, reply to mentions or other tweets, and reply to direct messages.

There are many bots on Twitter, used for customer service, marketing, information, and fun.

BOT libre makes it easy to create a Twitterbot and auto a Twitter account. You can connect your bot to your Twitter account from your bot's Twitter page under Admin.

Twitterbots can:

  • Reply to direct messages and mentions
  • Search tweets targeted by keyword and reply or retweet
  • Review and reply or retweet friend's tweets
  • Tweet an RSS feed
  • Auto tweet

BOT libre has a dedicated Twitterbot server at,

What is an AI bot?

An Artificial Intelligence or AI bot is one that is attempting to be an intelligent entity.

AI bots have been made famous by movies and include such bots as:
  • HAL
  • Skynet
  • WOPR
  • Ultron
  • Jarvis

There are many AI bots on the Internet, but none that have achieved the level of intelligence given to them in the movies.

BOT libre's AI engine is designed for strong artificial intelligence. BOT libre bots are not simple scripts, or text search and processing programs. Each bot has its own knowledgebase of interconnected information that it can extend and manipulate. If enabled, bots can learn from their chat interactions and make inferences.

BOT libre's Self scripting language allows language to be parsed and understood. Bot's have a concept of emotions, and a conscious state. Bots can perform complex mathematics, lookup information on the Internet and use knowledge graphs in processing language.

Thursday, May 7, 2015

Support BOT libre on Kickstarter - "free open artificial intelligence for everyone"

We live at the dawn of the age of artificial intelligence. The artificial intelligence technology revolution will be bigger than the Internet and mobile technology revolutions combined. We believe artificial intelligence technology should be for everyone and owned by no one.

The Plan

Help us make,

"free open artificial intelligence for everyone"

We have been developing our BOT libre AI platform since 2013, and it is based on open source technology that was started in 2008.

Our goal with this campaign is to raise enough funds to allow us to open source our technology and web platform under a non-profit organization to pursue the development of strong artificial intelligence.

We plan to apply the Wikipedia model to an artificial intelligence platform. Instead of making all of the world's information free and open, we plan to make all of the world's knowledge and intelligence free and open.

Where we are today

Currently we have a web based AI platform that lets anyone create their own bot that can interact with people through chat, twitter, email, and IRC.

We also have a web API, open source Android and JavaScript SDK, an Android app, and are working on an iOS app.

Our platform is not a simple chat platform, each bot has its own brain stored in it own database on its server. The bot has complex interconnected knowledge and can add and change its knowledge, or import knowledge from the web. The bots can currently understand simple phrases, complex math, make inferences, self program, learn new responses, and emote emotions.

Create Bots with a Real Brain

We are just getting started, and our end goal is intelligence that is equal or greater than that of a human. We are looking for crowd funding help to keep our platform open, and continue our development.

Support us on Kickstarter,

Thursday, January 8, 2015

Introducing the Self scripting language

The Self scripting language is Bot Libre's language for scripting bot responses. Self is based on the syntax of JavaScript with several extensions for language processing. Self is an integrated environment that merges JavaScript, state machines, patterns, and an object database.

If you already know JavaScript, you should find the Self syntax quite familiar. Self supports most JavaScript concepts and syntax, (if you notice something missing you would like, please let us know). If you are new to programming, the JavaScript syntax is quite simple, and there are lots of resources available on the Internet (such as w3schools).

One big thing about Self is that it is integrated with the bot's knowledgebase. This makes it easy to access any of the bot's knowledge and add new knowledge. Self is a persistent language, any data your create or change will be persistent in the bot's knowledgebase. The Self code objects are also stored in the bot's knowledgebase, so a Self script can actually change itself, hence the name "Self".

There are two ways that you can utilize Self. The simplest is to define a Template response. You can define a template response anywhere you define a response, including the Training & Chat Logs page, or in a chat correction. A template response is a response to a phrase or a pattern that can include Self code. For example "What is your name?" could have the template response Template("My name is {}."). The { } brackets are used to denote Self code embedded within the response text, and the Template keyword is required to define a template response. The code within the brackets is Self scripting code.

The second usage of Self is from a program script. Program scripts can be defined or imported from the Scripts page in your bot's Admin Console. A new bot will have a default bootstrap set of scripts, that can do things such as understand simple language, perform math, tell the current date or time, or look information up on Freebase. You can alter, extend, import, or create your own scripts to do virtually anything. Scripts are more complex than templates, but more functional. A Self script is essentially a state machine that processes the input.

Self Syntax

The Self syntax is the same for template responses and functions within a Self script. Self scripts also contain additional syntax for defining state machines. A state object is similar to a function in JavaScript but is specialized for processing input. Self also merges many concepts from AIML, such as Pattern and Template objects, and SRAI calls.

Self is an untyped object oriented language the same as JavaScript. Everything in Self is an object (this includes the Self code itself). An object can be data, such as a string, number, date, time, or symbol. Objects can have relationships to other objects.

Data Types

The Self data types are similar to the JavaScript data types, and most other programming languages. Self also adds special symbol, pattern, and template data types.

The following are examples of Self data types:

  • "hello" - strings/text
  • 1234 - numbers
  • null - null/void value
  • true, false - boolean values
  • Date("1973-11-10") - dates
  • Time("11:00:00") - times
  • Timestamp("1973-11-10 11:00:00") - timestamps
  • #foo - symbols
  • Symbol("foo") - symbols using JavaScript syntax
  • Object(34789) - object references
  • [1, 2, 3, 4] - arrays
  • { name : "Bob", age : 44 } - objects
  • Template("The answer is {result}") - template objects
  • Pattern("what is *") - pattern objects


Variables in Self can be declared using the var operator the same as JavaScript. Also similar to JavaScript, variables do not need to be declared, but will be declared automatically when used.

Within a template or state Self has access to several global variables:

  • input - the input object being processed, such as a user's chat message
  • sentence - the current input sentence being processed
  • speaker - the user that sent the input
  • target - the user the input was sent to (normally this is the bot, but could be another user in a chatroom)
  • conversation - the active conversation
  • star - if a pattern was used, the star variable has the value of the * text from the pattern


The operators in Self are similar to JavaScript, and most other programming languages. Self also defines a few special operators for knowledge processing, or borrowed from AIML.

The following are the Self operators:

  • if - if statement
  • for - for statement
  • while - while statement
  • do - do statement
  • think - the same as do but can be used inside a Template to perform some code but not print a value into the response
  • return - return the value
  • == - compare if two values match
  • != - compare if two values don't match
  • < - compare if a value is less than another
  • <= - compare if a value is less or equal than another
  • > - compare if a value is greater than another
  • >= - compare if a value is greater or equal than another
  • ! - negates a logical value
  • && - logical AND
  • || - logical OR
  • = - variable assignment
  • ++ - increment a variable
  • -- - decrement a variable
  • + - add two numbers or concatenate two strings
  • - - subtract two numbers
  • * - multiply two numbers
  • / - divide two numbers
  • new - construct a new object
  • Symbol - create a new global symbol
  • . - get a relationship from an object
  • = - set a relationship on an object
  • =+ - add a relationship on an object
  • =- - remove a relationship on from object
  • random - select and execute random value
  • redirect - evaluate the response to the phrase
  • srai - synonym for redirect (AIML syntax)
  • request - evaluate the response to the phrase using a remote service
  • sraix - synonym for request (AIML syntax)
  • learn - learn a new response
  • eval - evaluate code within a learned pattern or template
  • debug - print the arguments to the log


The if statement is the same as JavaScript and similar to other languages, in that it has a logical condition, and optional else if and else conditions.


if (value == null) { ... } else { ... }

if (value) { ... }

if (!value) { ... }

if ((word == "you") && (word2 == "are")) { ... }

if ((word == "I") || (word == "me")) { ... }

if (value != value2) { ... }


The do statement is similar to other languages. do is used to perform multiple operations sequentially.


do {
    response = new (#sentence);
    response.append(#word, "Hello");
    response.append(#word, "world");
    return response;


The for statement is similar to JavaScript and other languages. for is used to iterate over an object's relationships. It takes the relationship type, the source object, and a variable to assign each related value to.


for (word in sentence.word) {
    if (word.has(#instantiation, #keyword)) {
        conversation.topic = word;

for (count in number.sequence) {
    response.append(#word, word);


The return operator will return the result from the current function. If an function has no return value, the result of the last operation will be returned. If null is returned it is an indication that function failed to generate a response, and if used from a state machine, the next case or answer will be used.


if (word == "hello") {
    return "hello there";


The ! operator will negate a logical primitive (true -> false, false - > true). If the value is not a logical value, the value is returned.


negative = !negative;


The = operator assigns a new value to a variable.


name = Language.word(firstName, lastName);


The new operator creates a new object of the type. An object can be an instantiation of one or more classification objects. Most classifications are defined by a symbol, you can define your own classifications, they are just another object that is an instantiation of #classification. You can also add a classification to an existing object using the instantiation relationship.

Common classifications include, #word, #compound-word, #name, #sentence, #number, #date, #time, #person, #speaker, #classification, #formula, #pattern, #variable, #keyword, #thing, #description, #action, #adjective, #noun, #verb, #punctuation, #question, #paragraph, #topic, #tweet, #email, and #url.


response = new Sentence();

response = new (#sentence, #question);

name.instantiation = #name;


The Symbol operator create a new primitive symbol representing the meaning of a word. Symbols are unique, global, and persistent objects. Any relationship set on a symbol will be persisted and remembered. There are many common symbols used in the bot's knowledgebase, the symbol #self represents the bot.


Language.define(word, Symbol(word));


The . operator gets the value of a relationship. If the relationship has multiple values, get will return the most conscious to the current context. most conscious means the relationship that has the highest correctness factor, and is most associated to the recent input. get can optionally include an [] modifier to get a specific index in an ordered relationship. Negative index values will return the indexed element from the end.


age = speaker.age;




The = operator sets the value of a relationship. Set first clears any existing relationships of the same type, and is meant to be used with single value relationships.


conversation.topic = star;

speaker.age = 44;

response.word[0] = "Hello";


The =+ operator adds a value to a relationship. add is similar to set, but adds to the relationship, and does not replace the existing value. If the value already exists, its correctness will be increased.


thing[action] =+ description;

sentence.response =+ response;

speaker.gender =+ #male;


The =- operator removes a value from a relationship. The remove operator can be used to define an inverse relationship. An inverse relationship can be used to inform the bot that a such a relationship is incorrect. If dissociate is used on a inverse relationship that already exists, its correctness will be decreased.


sentence.response =- response;

speaker.gender =- #female;


The random operator selects one of the arguments at random.


random ("Hello", "Hi", "Hey", "G'day mate");


The srai or redirect operator recursively evaluates the phrase and returns the response. It can be used to redirect a response, or break up a question into several components. srai was borrowed from AIML, and can be used in conjunction with patterns to process text fragments.


srai ("hello");


The sraix or request operator sends the phrase to a remote service. A settings objects can define which service to use and provide a data hint or default. A service can be a web service such as #freebase, #wikidata, or #pannous, or another bot on another server.


sraix (song, { service : #wikidata, hint : "performer"));

Object Methods and Classes

Self defines several object method available to all objects.

Object methods:

  • get - get a relationship value from an object, optional index - Example: speaker.get(#name), sentence.get(#word, 3)
  • getLast - get a relationship value from the end of an ordered relationship - Example: conversation.getLast(#input, 1)
  • getWithAssociate - get a relationship value from an object most associate to the other value
  • all - returns an array of all of the object's relationship values for the type - Example: speaker.all(#name)
  • set - sets a relationship value on an object - Example: speaker.set(#age, 44)
  • append - append the value to the end of the object's relationship - Example: response.append(#word, ".")
  • appendWithMeta - add a relationship value to the object with the relationship meta data
  • add - add a relationship value to the object - Example: speaker.add(#name, "Bob")
  • addWithMeta - add a relationship value to the object with the relationship meta data
  • weakAdd - add a relationship value to the object with a low correctness
  • weakAddWithMeta - add a relationship value to the object with a low correctness with the relationship meta data
  • delete - delete the relationship value - Example: speaker.delete(#name, "Bob")
  • remove - remove the relationship value - Example: speaker.remove(#name, "Bob")
  • removeWithMeta - remove the relationship value with the relationship meta data
  • deleteAll - delete all the relationship values - Example: speaker.deleteAll(#name),
  • delete - delete the object, (use this with caution) - Example: speaker.delete()
  • has - return if the relationship exists - Example: speaker.has(#name, "Bob"), speaker.has(#name)
  • findReference - inverse references lookup
  • findReferenceBy - inverse relationship lookup

String methods:

  • chatAt - return the string's character at the index
  • concat - concatenate the two strings
  • substring - return the string substring
  • toLowerCase - return the string as lower case
  • toUpperCase - return the string as upper case
  • trim - trim leading and trailing whitespace

Self defines several utility classes and methods. Classes can be referenced by name similar to JavaScript i.e. Language.word("hello") or as symbols i.e. #language.word("hello").

Language methods:

  • word - creates a compound word - Example: Language.word("ball", "hockey")
  • sentence - creates a sentence - Example: Language.sentence("How", "are", "you")
  • define - defines the word as meaning the value - Example: Language.define("foobar", #foobar)

Date methods:

  • date - current Date object
  • time - current Time object
  • timestamp - current Timestamp object
  • add - add the date value
  • interval - computer the date/time interval
  • getTimeZone - return the default time zone
  • getTimeZone - return the dates time zone
  • setTimeZone - set the dates time zone
  • printAIMLDate - print the date using the AIML format
  • printDate - print the date using Java SimpleDateFormat format

Util methods:

  • denormalize
  • normalize
  • explode
  • gender
  • person
  • person2
  • program
  • size
  • version
  • id

Math methods:

  • add
  • subtract
  • multiply
  • divide
  • abs
  • floor
  • ciel
  • power
  • round
  • log
  • ln
  • sin
  • asin
  • cos
  • acos
  • tan
  • tanh

Self Scripts

Self is based on processing input. An input could be a chat message, or an email, tweet, or other input. The input is wrapped in an input object which contains the phrase or data. A Self script will normally begin by extracting the phrase from the input, then processing each word in the phrase in sequence. A Self script is broken into a series of states. The first state will process the first word, then if the word matches a case, it will transition to the child state to process the next word.

When a state sequence reaches the end of the sequence of words in a phrase, it is considered a successful match. Once matched, if the state contains an answer, the answer will be evaluated, and the response returned.

A Self script is composed of the following components:

  • state - A state defines the current input processing.
  • case - A case can transition to another state if the case variable matches the current input.
  • pattern - A pattern can match an input and evaluate a template response.
  • answer - An answer of a state is evaluated if the input processing is complete.
  • function - An function can be called from an answer or another function.
  • var - A variable can be matched with the current input, or store context.


The state defines the current input processing. Every Self script start with a root state, which is the name of the script. The state can evaluate the current input and transition to another state, or return an answer. A state can include definitions of sub-states, variables, and functions. A state is composed of a sequence of operations which can include case, pattern, do, goto, and return.


// Example simple pattern based state.
state Hello {
    pattern "hi" template "Hi there";

    pattern "^ hello ^" template "Hello there";

    pattern "[bye goodbye]" template "Goodbye.";

    pattern "my name is *" template Template("Pleased to meet you {star}");

    pattern "what is your name" template Template("My name is {}");

    pattern "what (day) is today" template Template("Today is {}");


// Example state that parses a sentence and executes a function
state Repeat {
    case input goto sentenceState for each #word of sentence;

    state sentenceState {
        case "repeat" goto repeatState;

        state repeatState {
            case someWord goto repeatWordState;

            state repeatWordState {
                case digits goto repeatWordNState;

            var digits {
                meaning : number;
            var number {
                instantiation : #number;

            state repeatWordNState {
                case "times" goto repeatWordNTimesState;

                state repeatWordNTimesState {

                    answer repeatResponse();

                    function repeatResponse {
                        response = new (#sentence);
                        for (count in number.sequence) {
                            response.append(#word, someWord);


The case operator defines a state transition. If the current input matches the case value or variable, then it will transition to the case goto state. A case can also return a template, return and abort the current state, or restrict the match to a topic or previous that match. A state can also process the transition state for a collection of values.


case "hello" goto helloState

case name goto nameState

case "lol" template "Very funny."

case "what" topic "joke" that "what do you get when you cross music and an automobile" template "a car-tune"

case "huh" return


The pattern operator evaluates if the input sentence matches the pattern. A pattern is an easy way to evaluate a phrase and return a template response. A pattern can include wildcards using the * character. The * word or text fragment it matched to the star variable which can be used in the response.


pattern "hello" template "Hi there";

pattern "my name is *" template Template("Pleased to meet you {star}");

pattern "what *" topic "joke" that "what do you get when you cross music and an automobile" template "a car-tune";


An answer defines a state's response, and is evaluated if the state is done processing input.


answer "Hi there"

answer Template("Pleased to meet you {star}");

answer repeatResponse();


A function defines a Self function that can be evaluated to return a response, or process input.


function todayResponse {
    var response = new (#sentence);
    response.append(#word, "Today is");
    response.append(#word, ".");
    return response;


A variable defines a matching pattern, or temporary state. Variables can define relationships that must be included or excluded to evaluate a match. Variables are used in a case operation, if the current input matches the variable, then the case is evaluated. Variable make it possible to define generic functions that can process any noun, number, or name.


var digits {
    meaning : :number;
var number {
    instantiation : #number;

var name {
    instantiation : #name;

var noun {
    instantiation : #noun;

var firstName {
    instantiation : ! #verb, ! #adjective, ! #pronoun, ! #punctuation;
    : "Bob", "Fred", "John", "Jill";
    : ! "long", ! "cool";

Self vs AIML

Self is very different than AIML. Self is based on knowledge and state processing, where as AIML is based on patterns and text processing. Self can do everything that AIML can do, and a lot more. If you are experienced with AIML, and want to know how to do the same thing in Self, just import the AIML script and it will be converted to Self.

Self Examples

Bot Libre provides a shared repository of Self scripts and examples that you can import, customize, and learn from. You bot will also come bootstrapped with several Self scripts that you can learn from and customize.

See the Self script category for all of the example scripts.