Chatbot plugin
Posted: Wed Jan 27, 2016 5:27 pm
The first version of my Messages app plugin would try to find and execute Action Groups with names matching incoming messages. I got tired of the limitations of that approach quickly and decided that what I really needed was two plugins. One plugin focused on sending and receiving messages, and another plugin to connect incoming messages to Python scripts that could both make things happen in Indigo and figure out what response to send back. This is the second plugin, which with a little bit of setup to coordinate it with whatever message delivery service you are using, will turn Indigo into a chatbot.
There's no shortage of open source software around for building chatbots, but I couldn't find anything that was exactly what I was looking for, so I collected various ideas I liked from the chatbot world and wrote my own little chatbot engine. It will import a directory full of Python files, where the decorator syntax is used to associate messages to be matched with methods to run, and the methods can work with Indigo just like other Python scripts, and then return text responses to be sent back to the user.
The plugin defines devices called "Chatbot Responders" and a "Get Chatbot Response" action which takes a message, gets a response and stashes it in device states along with the original message, the sender's name, and three generic text fields which you can use to save address information to help you deliver the return message.
Example scripts, incomplete documentation and a download link can be found here: https://github.com/gazally/indigo-chatbot
There's no shortage of open source software around for building chatbots, but I couldn't find anything that was exactly what I was looking for, so I collected various ideas I liked from the chatbot world and wrote my own little chatbot engine. It will import a directory full of Python files, where the decorator syntax is used to associate messages to be matched with methods to run, and the methods can work with Indigo just like other Python scripts, and then return text responses to be sent back to the user.
The plugin defines devices called "Chatbot Responders" and a "Get Chatbot Response" action which takes a message, gets a response and stashes it in device states along with the original message, the sender's name, and three generic text fields which you can use to save address information to help you deliver the return message.
Example scripts, incomplete documentation and a download link can be found here: https://github.com/gazally/indigo-chatbot