GamerNewsBot is one of the many complete chatbots that we are building with Xenioo to showcase different core features. The idea of this bot is to have a news service that pushes gaming news to your users by digesting multiple RSS feeds automatically.
A good idea when creating a chatbot is to start with the basic bullet points of everything we would like to implement so that we can have an overview of what is required. Our bot shoud:
- Greet the user and describe itself and its services.
- Ask the user permission to push automatic news. We do not want users receiving any message they don’t want 😉
- Support a basic array of smalltak and a couple of specific questions like where the news come from
- Get the news from the configured feeds and distribute them to the users that subscribed every time they are available.
Greeting the user
This is the starting point of our bot. We should greet the user and describe what kind of services we are providing. Doing this with Xenioo is fairly easy and we should have learned it since the very first tutorial. I would suggest to come out clear and tell immediately that it is a bot speaking: most people don’t mind interacting with a bot but may be upset to discover it later rather than sooner.
Since GamerNewsBot was published in multiple bots directories we later wanted to know from where the new contact was coming from: this is something you can easily add and since every conversation input of Xenioo is saved in a user variable, you can later analyze it to see how many people come from specific services and maybe change the conversation flow accordingly.
Would you like to subscribe?
Asking the user permission to send unattended broadcasts serve two purposes: the first is to make sure that we do not send anything not requested to anyone. On many platforms, Facebook Messenger for example, sending unattended or unwanted messages may result in temporary or permanent ban of your page or of your bot, so always make sure to have an explicit permission.
Secondly, we want to store the user reply in a specific conversation variable. This variable can then be used in our broadcast to filter for a specific audience.
Everything is easily managed with Xenioo Variable Actions and Interaction Switches, but what if the user wants to unsubscribe later? We need to make sure that the bot is accepting some kind of “unsubscribe” command anywhere and everytime. To do so, we are creating an NLP unsubscribe intent like the one below:
Remember: you do not need to specify every possible expression your users may send. Xenioo NLP engine is capable of understanding variations and similar expressions and, once trained, can fully understand even the most uncommon utterances.
Once the intent has been created and trained, we can attach it to our bot. Global Behavior Operations are executed regardless of the current interaction and can be used to detect a general intent in the user chat flow. While interaction specific NLP or Standard Questions Actions act only in the specific interaction, Global Behavior Operations can be triggered anywhere in the behavior.
Since we want to allow our user to unsubscribe (or subscribe again!) we are adding our NLP intents to the Global Behavior Operations list.
Everywhere during the chatflow, as the user types subscribe or unsubscribe, we’re changing the value of our “notification” variable to either yes or no. This, in turn, will move our user from the unsubscribed to the subscribed audience or vice-versa.
Implementing the bot smalltalk
While the user knows that there isn’t a human on the other side, it is often a good sign of a well crafted bot to add some kind of very basic “smalltalk”. Often users like to interact, even if virtually, with a chatbot to see its capabilities and adding some funny replies to most common questions like “how are you” or “who are you” may be you winning move to get a subscription to your service.
GamerNewsBot has a set of multiple NLP intents specifically created to manage standard smalltak. They are intended to manage most of the very basic interactions but as you can see they are so easy to create that adding them is a matter of minutes. Again: you don’t need to specify every single user possible utterance. Xenioo NLP Engine si perfectly capable of inferring phrase changes from training.
As you can see, we wanted to push every time a small help for the user, giving after every answer a recap of the commands. That is not entirely necessary but really up to you: remember your users may come back after a long while and not really remember what and how they can use your bot. Giving them a recap of the commands, or an easy way to access them is a good idea.
Reading and Distributing the Feeds
This is where the real action happens and it will be a topic for my next post: we will see how we can manage a fully automated scheduled news broadcast without writing a single line of code: all the magic will happen in Xenioo! 🤩 Also, as with every example and full bot we create, everything is already available to you as a template in your Xenioo Templates Section!