In this guide, an xmpp based client-daemon is used as a chat-bot, this chat-bot is written in C++ and it is based on gloox-xmpp-client library. Xmpp provides an easy way of communication between two clients which are typically behind a firewall. A jabber server with public-ip over internet helps to achieve this secure communication between two xmpp clients.
Following steps explain how to compile and run the xmpp-client-daemon(chat-bot) on raspberry pi. Here is a diagram showing typical setup of remote communication between raspi and a smart phone.
How to prepare raspberry-pi to act as a chat-bot?
(following steps are tested on a raspi running 2017-11-29-raspbian-stretch-lite.img)
Check on your android phone's hangout if "my-raspi-usrname" is online, if so, then send "help" message and the reply would show the list of available commands.
Note-1: For proper operation of xmpp with google account, ensure that your Raspi's account has this allow-less-secur-apps setting enabled.
Note-2: Two xmpp accounts need not be on google, any two jabber accounts would work. Here is an explanation on preparing the jabber accounts.
Following steps explain how to compile and run the xmpp-client-daemon(chat-bot) on raspberry pi. Here is a diagram showing typical setup of remote communication between raspi and a smart phone.
How to prepare raspberry-pi to act as a chat-bot?
(following steps are tested on a raspi running 2017-11-29-raspbian-stretch-lite.img)
- Login to the linux-shell-terminal of your raspi using directly connected keyboard or ssh.
- sudo apt-get update
- sudo apt-get install cmake git libjson-c-dev libgloox-dev openssl
- mkdir /home/pi/xmproxy
- cd /home/pi/xmproxy
- git clone https://github.com/hackboxguy/brbox
- cd /home/pi/xmproxy/brbox/sources
- cmake -H. -BOutput -DCMAKE_INSTALL_PREFIX=/home/pi/xmproxy/buildir -DAUTO_SVN_VERSION=OFF
- cmake --build Output -- install (suffix -j5 incase of quad-core-raspi for faster build)
- cd /home/pi/xmproxy/buildir
- echo "user: my-raspi-usrname@gmail.com" >/home/pi/xmproxy/buildir/xmpp-login.txt;echo "pw: super-secret-pw" >>/home/pi/xmproxy/buildir/xmpp-login.txt
- export LD_LIBRARY_PATH=/home/pi/xmproxy/buildir/lib
- /home/pi/xmproxy/buildir/bin/xmproxysrv --loginfile=/home/pi/xmproxy/buildir/xmpp-login.txt
Check on your android phone's hangout if "my-raspi-usrname" is online, if so, then send "help" message and the reply would show the list of available commands.
enjoy chatting with your raspi-chat-bot!!
Note-1: For proper operation of xmpp with google account, ensure that your Raspi's account has this allow-less-secur-apps setting enabled.
Note-2: Two xmpp accounts need not be on google, any two jabber accounts would work. Here is an explanation on preparing the jabber accounts.
Note-3: steps explained above would work on any debian based linux distro machine.
source code is open, suggestions and contributions are welcome.
6 comments:
Informative Article
hello once installed there are programming examples I would like to create a question and answer bot with sending photos and videos ..
Acknowledging the dedication of our team to maintaining a positive and inclusive online community. Appreciate the creators of this Online Reaction Time Test for offering an entertaining yet valuable means to assess and improve mental reflexes.
I appreciate the thoughtfulness and intentionality behind each of your blog posts – thank you! Get ready to unleash your inner comedian and sharpshooter in Funny Shooter 2 Online - it's a riot!
Your blog consistently inspires me to take action. Thank you for motivating me with your practical and insightful advice. Discover extra content in this article. Discover how fast your fingers really are by taking the Clicks Per Second Test and improving with each attempt.
Your blog has been a great source of inspiration for me. Thank you for consistently offering content that encourages me to keep working toward becoming my best self. Discover fresh advice in this profile. Try GeoDash Lite today and experience the thrill of fast-paced platforming set to catchy, electronic soundtracks.
Post a Comment