Deltabot Quickstart: implement and run a chat bot with Python
Deltabot allows to implement and run chat bots for Delta Chat.
Install
To install deltabot run the following command (preferably in a virtualenv
):
$ pip3 install deltabot
Try typing "deltabot --version" to verify it worked.
Note
Deltabot requires Delta Chat's Python bindings. On Linux bindingshave pre-built binary wheels and thus the above deltabot install should just work.On other platforms you need to install the bindings from source, seedeltachat Python bindings readme.
Initialize the bot
Configure an e-mail address for your chat bot (using example credentials):
deltabot init [email protected] OzrSxdx5hiaD
Within a Delta Chat app (or another e-mail client), you may nowsend a chat /help message to [email protected] and shouldget a short list of available commands in the reply.
Try out an example "calculator" bot
Checkout the deltabot repo to play with some example bots:
git clone https://github.com/deltachat/deltabotcd deltabot
Now you can register an example bot and send/receive messages:
Register the example "mycalc bot":
$ deltabot add-module example/mycalc.py
Now start serving the chat bot:
$ deltabot serve
Within an Delta Chat app, you may now send a chat /help messageto [email protected] and should get a short listof available commands in the reply. Send /mycalc 23+20-1 andwait for the the answer.
Note that the bot-answer speed largely depends on the provider you areusing for the bot-email address. On test servers we get 3-5 secondsfull roundtrips, between question and answer arriving back.
Writing setuptools plugins
You can implement your plugin as a proper python package or wheelby using setuptools. Have a look in the examples/deltachat_echoexample directory which contains a complete example.
note for users
Deltabot uses Autocrypt end-to-end encryptionbut note that the operator of the bot service can look intomessages that are sent to it.
Plugins
For many more examples and Deltabot plugins see: