How to implement Chatbots in kontalk platform?

Hi Kontalk team,

We are using kontalk/xmppserver-docker instance, and
We need some hints and clues to know, what is the best way to implement a chatbot in the kontalk platform? This chatbot will use a “standard” xmpp client library like node-xmpp-client.
So,

  • How to create the chatbot account? Username, password and/or encription keys
  • How this chatbot can authenticated to the server? What we need to do or setup?
  • How users in Kontalk AndroidClient app can add this chatbot to their rosters?
  • What could be the best way to include this chatbot in each user roster by default?
  • How to accept by default all presence/contact request to this chatbot?

Regards!

Hello!
Generally speaking, Kontalk is just a XMPP server using client certificate authentication (with a very peculiar certificate).

You can’t use username and password. But we did wrote a tool to generate personal keypacks (a zip file that is like the one created by the Android app when you export your key):

It is somewhat undocumented (it’s intended for internal use for now), but if you run it without arguments a quick help will show up. It’s very easy to use, it will create any user ID you choose by signing the new key with your server key (thus making it valid for authentication).

As above: certgen will generate a valid authentication certificate and keys for your bot. In the zip file you will find an X.509 certificate and private key to authenticate with.

That’s the complicated part. You can’t :slight_smile:
Pick a random phone number to use (e.g. +1234567), then calculate the SHA-1 sum of that number. That would be the user ID to provide to certgen (e.g. <sha1_sum>@<xmpp_service>).

Users would have to add the phone number (+1234567) as a new contact and, at the next contact sync, Kontalk will see the bot.

You need to modify either Tigase (server) or the Android app. That I know of, there is no way to do that with configuration - but I might be wrong. You can head to the Tigase forum to ask though.

I don’t think such a feature is present in Tigase server. Note that there is no need to subscribe to the bot’s presence (or vice-versa) to send messages to users.

Kontalk progress on native bots

As a matter of fact, I’ve been working on a bot infrastructure for some time, so far I’ve come up with two “experiments”:

  • konbot – both framework for building bots and simple interactive shell with some basic commands
  • databot – a bot that reads text messages from a dataset file and sends a random one to any user chatting to it; built on top of konbot

The framework is still very primitive, but I’ve successfully set up a couple of simple bots.
Also, verification process is still rough (that is, users trusting the bot cryptographically: messages are not encrypted yet and user subscription is required for handling key trust decisions - this requires modifications on the Android app too).