Categories

Creating a Slackbot Personal Assistant with .NET and an Office Fish

Creating a Slackbot Personal Assistant with .NET and an Office Fish

It wasn't too long ago that DMC Boston added a Particle Internet Button to remind us to feed our fish, Stevie. With Stevie doing so well, and DMC's FedEx Day coming up, we started brainstorming of what else could we do. We landed on turning Stevie the fish into an alternate online personality in the form of a personal assistant bot!

Automated personal assistants are everywhere these days. Siri and Google Now keep us talking to our phones. Amazon Echo and Google Homes are in our houses. They are all playing our music, ordering our Ubers, and answering our questions about entertainment, hard news, random facts, etc. The problem? DMC didn't have one too.

StevieBot the Personal Assistant

Instead of being jealous, we engineered away our problem and DMC now has StevieBot!

StevieBot can do a lot of things like report the weather, search Wikipedia, and define words for us.

He can even tell us jokes.

Based on the MargieBot architecture, DMC's StevieBot has a simple framework for .NET with a great library. You can find all the resources you need at MargieBot to begin creating your own custom Slackbots.

SlackBot Framework Functionality 

The framework operates by creating a bot configuration (i.e. giving your bot a personality). Like the fish who came before him, StevieBot needed that special "something" that makes him part of the DMC family. 

To achieve this "personality", the program loads various custom responders that you create.

The program then establishes a connection with Slack (as well as any other webs services) using a unique API key.

Slack to Bot Implementation

  1. In Slack, implement StevieBot as a Bot User.
  2. Create a custom Slackbot by going to your team’s settings page.
  3. Select create a new bot user.

Take note: To establish communication between the framework and Slack, you need the auto-generated API Token.

Bot Considerations - Bot Parameters

Once initialized, the framework waits for Slack to send a notification that it has received a message. The framework then parses the message and determines if the bot should respond.

The framework considers:

  • Who sent the message?
  • Was the bot mentioned in the message?
  • Was it a direct message?

Take note: These parameters are all configurable and can to determine how the bot will respond.

The framework checks the message for regular expressions using .NET’s included RegEx engine. The results of the checks determine the appropriate responder.

Finally, StevieBot creates a message and posts it back to Slack!

The Future - SlackBots and Particle Cloud Communication 

StevieBot also communicates with the Particle Cloud. This paves the way for potential IoT fish tank functionality in the future. We’ve already purchased some components including pH, temperature, and turbidity sensors.

For now, we can ask Stevie to poll the various Particle boards around the office and check their status.

Conclusion

Built on an expandable framework, plans exist to implement in StevieBot aspects of the neural network architecture for machine learning so StevieBot can be more proactive with messages. The future options are endless, but an assistant who can recommend lunches based on individual tastes sounds like a perfect start.

Fun projects aren't the only thing we do! Explore more of DMC's C# and .Net Development Services.

If you're sorry you missed another FedEx Day with us, check out our Career page!

Comments

There are currently no comments, be the first to post one.

Post a comment

Name (required)

Email (required)

CAPTCHA image
Enter the code shown above:

Categories