do_action Moscow 2018
or creating a chat bot for WordPress in 2 days.
Around 20 non-profit organizations took part in the hackathon over two days using WordPress to advance their causes. I was assigned to a team called Второе дыхание, a non-profit based in Moscow that gathers and recycles unwanted clothes, toys, etc.
Their idea was to create a chat bot for WordPress to help alleviate e-mail and Facebook chat support resource hogging.
I was set on creating solution from the ground up that:
1. uses native PHP 5.3 within WordPress without any external APIs
2. is not a mere interactive menu, but “understands” natural language
3. has a powerful scenario editor in the Dashboard that can be used to build any simple and complex chat scenarios
4. and exposes a simple REST API that can be used to integrate the bot into Facebook chat, SMS, other sites, etc.
With this in mind, A.R.N.I.E – Automated Reactive Native Intelligent Entity was created.
The bot uses simple regular expression keyword matching to find the best matching response, nothing too complicated, supports confirmations, human alerts, idle messages, etc. The bot is stateless and does not use the database to store any information on the server-side at all, all chats are private until the log is sent to an email if needed. The output can contain HTML and shortcodes. The REST API has a single endpoint and the bot can be inserted into any shortcode-supported area in WordPress. The editor UI was built using the Carbon Fields library and was by far the most complex UI I’ve ever built (being exclusively a backend developer).
Everything that was planned was completed on time for the demo thanks to help of my teammates. And we even wrote unit tests ? because testing rocks, even during time-limited hackathons! We didn’t win the event, though, but that’s okay, I was very happy that we could complete and produce a chatbot that can seriously help non-profits (and any type of WordPress site pretty much out there). It is partially translated to Russian, but written in English.
Oh, and did I mention I had to drive 200km to race a half-marathon in another city on Sunday morning!? Call that a crazy weekend!
(Event photos credit Мария Борисёнок)
On a related note, I’ll be leading a core contributor workshop at WordCamp St.Petersburg 2018, so if you enjoy writing code and hacking come visit ?