Chatbot XMPP connect


For those of you who still connect their chatbots via XMPP, we provide the necessary pointers and examples below. Please note that future chatbot development will focus on our Chatbot HTTP integration, so you might consider switching to that.

XMPP ConnectHow to connect to the Userlike chat server
Chat CommandsChat commands your chatbot can use
Dashboard integrationMonitor your chatbot's activity
Sample CodeSample code for chatbots

XMPP Connect

An existing Userlike account and an XMPP library are all you need to write a chatbot and connect it to the Userlike chat server. The required credentials:

PasswordYour Userlike password

Since XMPP is an open standard, you can choose from many existing libraries for different programming languages. The following coffeescript example shows how to connect to the Userlike chat server using the node-xmpp library.

Saving above code in "" you can now connect to the Userlike chat server in your shell, providing your Userlike credentials as follows:

For other XMPP libraries, the process is similar. Refer to your library's documentation when you are unsure how to use your Userlike credentials with it.

Chat Commands

Once your bot is connected to the Userlike chat server it can interact with your Webvisitors. Even better though, it has access to the Userlike chat commands, giving it full control over the initiated chat session. So your chatbot can collect and store data from your Webvisitors, send them to special parts of your web page or forward the current chat session to a human colleague.

The following commands are currently available, allowing for powerful automation patterns:

s/old/new/Correct a typo in your last message
![macroname]Send given text macro

A small example of a chatbot whose only task is to connect you to the next available human Operator, using the following commands: $quit $any.json $forward.json !bye

See the examples below for more details on how to integrate these commands with your bot logic.

Dashboard Integration

While we welcome automation for many tasks, we still want to monitor our trusted chatbot's activity. They are our loyal servants after all - or aren't they? Thankfully, all of your chatbot's activity is available via transcripts in your Userlike Dashboard, just like with any human Operator.

Continuing our simple example from above, the following interaction of a Webvisitor with your chatbot...

... shows up like every other chat transcript in the Userlike Dashboard:

You can easily filter all your chatbot's interactions for regular audits and check that it does its job as expected. Filtered results also include interactions that were only initiated by your chatbot and then switched to a human Operator, so you truly have a full overview.

Sample Code

We have started a GitHub repository to provide you with some complete code examples. Here is a full example for a (simple) chatbot.

Further examples/pull requests are welcome!