Siili participated in a workshop which introduced IBM Bluemix cloud services. The workshop was a lot of fun as we explored Integrations, APIs, various services and databases.
I wanted to create a Santa Claus SlackBot that listens to Christmas wishes, stores those in a database and sends an instant response to the user. In order to run my app in the cloud, I first deployed a sample application into IBM Bluemix and then modified it to fit my needs. I used the Node-RED Starter -application and some ChatBot npm-packages.
Find them here.
For chat connectivity I needed two custom integrations for Slack.
- Incoming WebHook
A bot needs to have a name and a description. The bot is added as a regular user on the selected Slack channel.
The switch statement is looking whether the Slack text posted by the user contains a certain sequence of characters.
The following function parses user and wishes from the payload. It also removes the “I wish for” –string from the payload.
Another function then concatenates the username, static string and the users wish.
Now Santa Claus´s response is ready to be submitted back to Slack. The bot response can also be formatted so I replace the bot´s username santa.claus with a more proper “Santa Claus” and add an icon for the bot users profile. The entire response is then returned to Slack as JSON.
So let's go to our Slack channel #ibmbluemixworkshop and type in a Christmas wish.
“I wish for …”
Our Bot gives a customized response and stores the wish in the database.
We are technology independent and have partnered with all major technology vendors such as IBM, Microsoft, Amazon and Oracle. In case you need a bot or any other type of digital solution built on top of these fine platforms, we’re more than happy to help.