Using Flow To Batch Schedule Tweets
(Republished with permission from Matt Wade and the AtBot Team)
You will need to have a few tools ready in order to build this Flow..
You will need:
-An Office 365 Account that includes Microsoft Flow and Microsoft Teams
-A Twitter Account
-A Google Drive Account (Gmail)
-Access to AtBot Free, Pro, or Enterprise (Link: https://atbot.io/ )
Let's Begin
Teams
You'll be creating a new channel within your preferred Team on Microsoft Teams. This channel will connect directly to all of the documents and links that you will need to manage this batch Tweet scheduler. I've named my Teams channel "Batch Tweet Schedule Center" to keep it simple. From this Channel you will be able to Tweet in two different ways:
1. Batch scheduling a large number of Tweets to cover many days
2. Posting immediate Tweets directly to Twitter
Google Sheet
Once you've created the Tweet scheduler Teams channel, find the Excel Document called "Tweet Batcher Template" that is attached to this article and download it. Then you will need to go to the Google Sheets Site and open the file picker from the "Start a New Spreadsheet" page. Click "upload" and select the Excel document and it will upload and be converted into a Google Sheets Document. This document is where your Tweets will be written & drafted, pulled by your Flow, and then tossed to the "Archive" tab once they've had their use. Next I'll explain the uses of the different sheet tabs that you'll find at the bottom of the sheet and I'll explain the uses of the columns that have been preset on the document.
-Draft
This sheet is here so you can work on all of your Tweets and not have to worry about them being accidentally deleted or posted because this tab will not be connected to your Flow. This sheet will also count your Tweet text length and tell you if it is over the limit for the Tweet character count in the count column. Once you are satisfied with a Tweet you can copy/cut it from here to paste it in the Batch Sheet Tab.
-Batch
This sheet tab is where the magic happens. Your Tweets will be pulled from this sheet in the order that you specify. There's come columns on this sheet that need some explaining because of the time zone change that needs to be done when using Flow and Twitter in combination. I'll explain those columns now:
--Tweets:
Cut/Copy and Paste your Tweets from the Draft tab to here when they are ready.
--Count:
Just in case you want to add something or tweak the Tweet a bit before you post it, this column will make sure you're still staying within the limit.
--Order:
This is where a formula may be inserted to moderate or randomize the order in which your Tweets will be posted. The template is ordered 1,2,3 etc. so that you'll start off posting them in order. However if you have a batch of Tweets that can be posted any time, any day, here's a formula to randomly order them: =RAND()
--Pub Time (Local Calc):
This column is the schedule for your Tweets that will reflect your local time zone. You may start it with today's date and time in order to test your Flow once you're finished. The formula for this column will keep your post times anywhere from 4.0 hours to 5.999 hours apart. You can change this varied gap by altering the (4,5) part of the formula. The Google Sheets will continue to randomize the times in this column every time a change is made to your Google sheet. The next column will allow you to keep these random times as your scheduled posting times. The formula for this column is: =D2+(RANDBETWEEN(4,5)+RAND())/24
--Pub Time (Local Static):
You will copy the randomized times from the "Pub Time (Local-Calc)" column and paste them here. This is how the times will remain static to be used by the next column.
--Pub Time (UTC):
This column is where your Flow will pull the posting times from. You'll need to change the times from whatever your local time is to UTC time because that is what Flow's Schedule connector uses to delay each post. For me, the formula to do this is: =E2+7/24. Below is a conversion table for US time zones to UTC time during daylight savings time.
-Archive
This is where you can cut and paste all the batches of Tweets that you've posted and you want to save for later editing and use.
Building Your Flow
Once you have finished filling out your Tweet Batcher Template and you have three to five tester Tweets lined up, it's time to build the Flow!
Start out by searching for the trigger called "AtBot Logic (Formerly Bizzy) - When An Intent Is Used". This is going to be what initially sets your Flow in motion when you type a message to @AtBot in the Microsoft Teams channel conversation. If you don't already have a free account set up with AtBot, this is where you will need to do that.
The trigger description is a description of what your AtBot intent will trigger. The keywords are the trigger words for AtBot to kick off this Flow, I am using the phrase "Batch These Tweets" to trigger my Flow. In your Microsoft Teams Channel, when you type a message to @AtBot using these keywords, it will trigger this Flow. This is how you "Use an Intent" with AtBot.
Next you're going to add the action called "AtBot Logic (formerly Bizzy) - Send Reply". The Reply Text is the message that AtBot will send you to let you know that the batch tweet Flow has begun. Select "Reply Activity" from the dynamic content panel for the "Reply Activity" field.
Next you'll add the Google Sheets action called "Google Sheets - Get Rows". This is where you will select the sheet from which your times and Tweets will be pulled.
Now you need to add an "Apply To Each" from the "more" tab.
Select "Records Value" from the dynamic content panel.
Insert a new step to your Apply To Each and select "Convert Time Zone". Select "Pub Time UTC" for the Base Time field. Select Round-trip Date/time pattern for the Format String field. Then Select your current or preferred time zone for the Source&Destination Time Zones.
Insert another new step to your Apply To Each and select "Delay Until". Open the dynamic content panel and select the expressions tab, this is where you will copy&paste this formula to finish up converting Flow's UTC time to your local time:
Add another new step to your Apply To Each and select "Post a Tweet" and then select "Tweets" from the dynamic content panel. This will pull the text from only the "Tweets" column on your Google Sheets document.
Add the final step on your Apply To Each and select "AtBot (Formerly Bizzy) - Send Reply". This is where you'll tell AtBot to let you know every time a Tweet from your batch has been posted and what the Tweet said.
Now you're done building your Flow! Time to build your teams channel and then test it all out!
Setting Up Your Microsoft Teams Channel
So now that you've built your Flow and loaded a few tester Tweets into your Tweet Scheduler, it's time to set up a Microsoft Teams Channel where you can monitor and manage your batch tweet posting all from one place as well as post live Tweets!
First you'll need to create a new Channel. I titled mine "JL Tweet Batcher" because I am batching tweets for the amazing Jon Levesque! Inside of the Teams channel, you will need to create a tab titled "Batch Tweet Scheduler" and another tab called "Live Twitter Feed".
Once you've created this Channel you need to add your Tweet Batcher Google Sheets Document URL. You can find this URL by clicking "SHARE" when viewing your Batch Tweet Scheduler Google Sheets Document and copying the link and pasting it to the "Add a Website" window when you select "Website" from the "add a tab" pop-up menu on Teams. This will make it so you can edit your Batch Tweet Scheduler Sheet right here from Microsoft Teams.
To make the "Live Twitter Feed" tab, you'll need to select "Website" from the add a tab pop-up window on Teams. This time you'll just enter the URL to your Twitter feed and it will be there for you to be able to access Twitter and post live Tweets directly from Microsoft Teams as well!
Next you need to add the AtBot application to your Microsoft Teams. You can do this by clicking the three dots at the bottom of the menu bar on the left and searching for "AtBot". Once you've added the AtBot App to your Microsoft Teams then you'll be able to test your Flow.
Testing Your Batch Tweet Scheduler Flow
The easiest way to test out this Flow is to have a couple of tester Tweets lined up in your Tweet Scheduler that are only a few minutes apart. And make sure to set your first tester Tweet's time so that you have a few minutes to trigger your AtBot Intent, because any Tweet's Pub Times that are past will post immediately when the Flow is triggered.
Remember what I mentioned about copying the randomized times from column D and pasting the values only to column E, the "Pub Time (Local Static)" column, so that the times remain the same. Then the formulas in the next column, "Pub Time (UTC)", will change the times to UTC time, which is the time zone that Flow operates on.
This will ensure that your Tweets post at the correct times. Before you start this Flow, make sure that your times are incorrect, because all of the Tweets that you have batched will post at once if you forget to update all of your columns before you trigger the Flow. And trust me, you don't want that to happen, especially if you have 20 Tweets lined up and ready to go for someone else's Twitter handle.
Also you'll need to make sure that you have nothing in the rows below your last tester Tweet. If there is data below the last row of Tweets then the Flow will fail at the end of the batch instead of sending you the end message in teams telling you that the batch posting has completed.
Flow will automatically create another column on the sheets document containing data for each row once you've used the AtBot intent to trigger the Flow. This data is used by your Flow while it is running and this column can be deleted before each batch is started because Flow will automatically create a new one.
Once you've double checked your times and dates and you have your tester tweets lined up and ready, it's time to use your AtBot Intent to trigger the Flow.
In the conversations tab for your Tweet Batch Scheduler Microsoft Teams Channel, you can call to your AtBot intents by typing "@AtBot" before your message.
Type the keywords that you selected when creating your Flow and send them to @AtBot. As you know, my keywords are "Batch These Tweets".
AtBot will immediately send you the response saying that your batch of Tweets has begun. Then it will send you an alert message on the teams channel every time your Flow posts a Tweet, telling you what that Tweet said. As long as your tester Tweets all post at the times you've set and you get the end message from AtBot in Teams saying that the test batch has finished, you'll know that your Flow Tweet batcher is ready to use!
So there you have it!! A completely free and simple way to Batch Schedule your own Tweets using Microsoft Flow and a couple of other awesome tools including AtBot and Microsoft Teams!
Thanks for Reading!
Gabriel Hollandsworth
Microsoft Flow Community Manager
*This post is locked for comments