DEV Community

Cover image for Creating bots in seconds!
Luke Garrigan
Luke Garrigan

Posted on • Updated on

Creating bots in seconds!

Halloween has been and gone, which means Christmas is coming!! And I wanted to be the first blogger on DEV to release a Christmassy blog 🀣 β€” much to the annoyance of the scrooges out there!

Recently I've been doing a tonne of bot development both at home and at work and been absolutely loving it β€” bots that integrate with Alexa, Google Home, and more.

During this time I've done quite a bit of research into the best and quickest methods to create bots and was pretty shocked when I bumped into Microsoft Flow. Microsoft flow is cloud-based software that allows you to easily automate workflows and tasks across multiple applications and services. For me, the ability to really quickly auth with multiple apps instantly has made the process so much more enjoyable allowing me to spend more time on what I want the bot to do.

Let's create a twitter bot!

I've just created a new twitter account @GrinchEndOfFilm because we want our bot to love Christmas and spread as much Christmas cheer as possible!

The Grinch Bot

The first thing we need to do is sign up to Microsoft Flow which can be done here!

Once we're all set up we can create a new flow:
Image of the flows
There are 4 types of flow to choose from, the two that we're going to look at in this blog are:

  • Automated Flow: Triggered by an event β€” our trigger is going to be when somebody tweets about Christmas!
  • Scheduled Flow: So you choose when and how often your flow runs β€” we're going to create a flow that tweets how many days until Christmas and it's going to do that every day.

Creating an Automated flow! (Super Simple)

Goal: Create a bot which retweets lovely Christmas tweets

So our bot flow is going to be called SpreadChristmasCheer with a trigger of when somebody tweets.

Creating an automated flow

When you click create you'll be presented with a lovely UI view of your bot flow so far. I want my bot to trigger when somebody tweets with the words "I" "love" "Christmas" in them:

And I want to just simply retweet them. So I click the + New Step button under the flow and create another twitter step with the action of Retweet.

Retweet step too

I then need to choose the tweet id of the tweet I want to retweet, luckily Microsoft Flow provides you with a list of related variables.
Tweet id

A quick save and test and it should be running!

A nice tweet about christmas

And there we have it, our Grinch (At the end of the film) has retweeted a pretty lovely tweet about Christmas πŸ˜„.

There is so much more you could do with this flow, for instance, you could easily implement some sentiment analysis on the tweet to be sure that it's actually a positive tweet about Christmas β€” that could easily be done by integrating the bot flow with Text Analytics which has an option for sentiment analysis.

Creating a Scheduled Flow

Goal: Create a bot that tweets every day the number of days until Christmas.

This one is going to be a little more complicated, not because creating a schedule flow is any more difficult than an automated one I'm just going to add a few pointless steps to show some features of Microsoft Flow!

The number of days until Christmas bot flow

The first step is going to be getting a Calendar event from my google calendars account, this event is Christmas β€” This is a pointless step as I am literally only going to use this event's name (Christmas) as an output to the tweet). It's just purely to show how quickly you can integrate other accounts and services, having to code this up would take ages, well, for me, it would.

Next, I want to call an endpoint I've created using Nodejs which will return the number of days until Christmas. Microsoft Flow has an action called HTTP

My endpoint returns some JSON, and in that JSON one of the values is the number of days until Christmas, I want to grab that value β€” luckily Microsoft Flow has an action which parses JSON for us and pops the values into variables we can use in other steps.

It asks for the content, which is the data we get in the body of the http request:

You can use an example payload to generate the Schema:

Lastly, let's add a step to post a tweet.

The current variable is the store value from the JSON which has the number of days until Christmas in it! And the Event Title is event from the Google Calendar integration.

Let's save this and get it running!


And there we have it! This is just a very basic introduction to what you can do with Microsoft Flow, there are hundreds of actions and integrations available. Pretty much any kind of flow you want there will be some way to create it.

Like I said, I'm new to this too but am finding it very, very fast and effective.

Thank you, if you like my rambling check out my personal blogging site at

Top comments (0)