- A Power Automate example: Pushing Microsoft 365 status notifications from Twitter to Microsoft Teams - Thu, Oct 29 2020
- Specops Key Recovery: Self-service for unlocking BitLocker-encrypted devices - Thu, Oct 24 2019
- Automating Remote Desktop Services certificate installation with PowerShell - Thu, Sep 5 2019
In our organization, we have active Teams channels for discussing customer work. Sometimes I am working on an issue that is related to a Microsoft 365 outage. My solutions ensure that a message will appear in our active Teams channel where we discuss the issues we are currently working on for clients. I want to stress that there are likely easier or better ways to achieve the same result.
I am assuming you have a Twitter account. You will also need a Microsoft 365 account with a license in a SKU that includes Power Automate. Let's get started!
From a web browser, go to https://flow.microsoft.com
From the menu bar on the left, click Create.
Under Start from Blank, click Automated Flow.
Enter a name for the flow, and under Triggers, search for Twitter.
Then select When a New tweet is posted and click Create.
In the flow designer, you will need to sign in to Twitter.
You will need to authorize your flow to communicate with Twitter. This creates an authenticated connection between your PowerAutomate account and Twitter. You will be able to reuse this connection in other flows if you want.
Once you have authenticated, the new tweet window will show you a dialog box. This is essentially a Twitter search box, so anything you input here is used to capture tweets. You can apply further logic to the tweet in another step.
In the search box, enter
This tells the flow to look for and trigger any time that account posts a tweet.
Click New Step.
In my flow, I decided not to include replies to other tweets or users, so I have added a condition where the response body of the tweet does not include the value in_reply_to_user_id.
For example, in this response body, a tweet is in reply to another tweet.
I am using a basic condition in this example flow. You can choose to adapt it so that it does include replies to its own tweets or omit this step to just capture every tweet.
A condition is basically a true or false determination for a given property.
Click the Choose a value field.
The flow expands what is called dynamic content. This is where the values associated with a step are listed for use. As you can see in the list, we have things like Tweet Text, Description, and Location. The list includes all the attributes or properties a tweet may have.
We can search the dynamic content for Reply and select the value we want to work with.
Select the in_reply_to_user_id item.
Select the middle dropdown item to view the options.
Now, because of the way Power Automate works, this can be a little tricky. We want to trigger our action when this value is either missing or equal to $null. Again, I reiterate there may be a better way to achieve this; however, this is how I did it.
Set the middle option to is not equal to and leave the last box empty.
This, in a true-or-false sense, means the result is true whenever that attribute has a value. All other scenarios (either missing or blank) result in false.
Under No, we can now add our Teams message.
Choose Add an Action, search for Microsoft Teams, and then look for Post a message as the Flow Bot to a Channel.
You can then use the drop-down menus, which parse your organization's Teams to find all the channels you have access to.
Post a Teams message
If you want to post the body of the original tweet, you will want to add dynamic content, Tweet Text, as the message. The subject will appear as a banner in Teams.
Your flow is now ready to be saved. The next time a tweet is posted, you will get a message in your Teams channel.