A complete news chatbot: creating GamerNewsBot with Xenioo (Part 2)
In the previous entry of this two parts story, we’ve seen how we can create the very first steps of our news chatbot. We’ve created the basic flow that will allow our user to check what we’re offering, subscribe and do a little small talk.
Now that our user has made our small tour and decided to subscribe, we need to make sure that the news are pushed regularly: in Xenioo, this is made trough a broadcast. Broadcasts are complete Xenioo Behaviors that can be scheduled and sent back to users anytime. There is no limit to the number of broadcasts you can create but keep in mind that, if using Facebook as a channel, there will be specific rules that you should follow to avoid unwanted usage reports.
When choosing when and how to send, you have multiple options: you can send a broadcast based on a trigger like the last time the user interacted with your chatbot or whenever a tag or a variable changes its value or, in this case, at a specific interval. Since we are going to have a lot of news but we do not want to pester our users, we will be choosing a 3 hours interval broadcast. A good approach to news push is avoiding too much info too frequently: we do not want our users to walk away.
Another very important parameter of all our broadcasts must be the target audience. While sometimes broadcasts are meant to be sent to anyone, most of the times you want to target a very specific segment of your chatbot contacts: using Xenioo, these segments are called Audiences. Using Audiences you create a multilevel filter that will dynamically select your users based on variables, tags and connection times. With GamerBot, we have created a flow where we are asking the user if he/she is willing to receive news now and then and we stored the reply in a variable: we are going to use that variable to create an ad-hoc Audience. Since Audiences are dynamically evalued eveytime they are needed, new users subscribing to the chatbot will automatically fall in this filter.
There is really no limit to the number of different group you can create by combining multiple filters based on usage. Letting the users specify multiple conditions and then create a broadcast based on that becomes trivial with Xenioo.
Now that we’ve setup our global broadcast parameters, it is time to design its chat flow. Xenioo broadcast design follows the very same principles of the standard chatflow design and of course, the very same flow interface. Using the same components you’ve been using to design your chatbot you can now create the contents that will be pushed to our users. GamerBot uses a fairly simple broadcast flow, build around a single interaction: most of the job is done by the RSS Feed Reader Action.
Xenioo RSS Feed Reader Action can read one or more RSS feeds and return the first unread item. GamerBot uses a grouped approach but you can easily split the feeds into multiple actions to push many different news simultaneously or create one specific broadcast for each feed. If you are looking for this last option, I would suggest to design the first broadcast and the use the very handy ‘Clone Broadcast’ command you can find near each broadcast in the main view list.
Looking at the feed action we see two awesome things: first, there’s nothing taking care of what feed item is new or not. All RSS feeds you specify are automatically managed by Xenioo engine to ensure that each user receives only those feed items that are new and users coming later to the chatbot will enter the news flow without receiving older entries. This is a very powerful feature that makes creating a feed reading chatbot a breeze.
The second thing you can see is how easily a very common feed problem is managed: not all the feed images are available in every entry. Sometimes there are no images or sometimes they are specified in a non-standard way. To avoid sending an update without an image, we use a conditional switch based on the RSS image field: if the field is empty, we just se the value to a default image. A very simple yet incredibly powerful feature: how many times did you struggle with this kind of problems while building your chatbot? Those days are long gone!
So now we’ve our broadcast, we have our up to date news feed…All we need to do is displaying it to the user! Like any other action consuming or producing data, the RSS Feed Reader Action automatically adds runtime variables to our chatbot. Using these variables makes the creation of a content a very simple task. We have chosen a carousel card because we can have a title a description and a nice image all in a nice package. All we have to do is use our RSS variables to fill Xenioo Card Container Action fields.
And its done! Incredible how fast and easy it has been? Well you can go check GamerBot yourself live or just create your by using it as a template: the full bot is available right now as a premium template for all subscribers!
Gianandrea is Matelab Srl co-founder and co-creator of Xenioo.
When not creating cutting edge business application solutions or chatbots plotting world domination, he can be found gaming, probably praising the sun.