A Power Automate example: Pushing Microsoft 365 status notifications from Twitter to Microsoft Teams

In this article, you will learn how to push Microsoft 365 status notifications from Twitter to Microsoft Teams with the help of Power Automate. This will give you an idea of how you can use Power Automate to take external information into Teams.

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

PowerAutomate homepage

PowerAutomate homepage

From the menu bar on the left, click Create.

Create a flow

Create a flow

Under Start from Blank, click Automated Flow.

Build an automated flow

Build an automated flow

Enter a name for the flow, and under Triggers, search for Twitter.

Choose a Twitter flow trigger

Choose a Twitter flow trigger

Then select When a New tweet is posted and click Create.

Create a Twitter flow

Create a Twitter flow

In the flow designer, you will need to sign in to Twitter.

Sign in to Twitter

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.

Authenticate to Twitter

Authenticate to Twitter

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.

Twitter search action

Twitter search action

In the search box, enter

from:@MSFT365Status

This tells the flow to look for and trigger any time that account posts a tweet.

Tweets from MSFT365Status

Tweets from MSFT365Status

Click New Step.

Add a new step

Add a 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.

Body response from Twitter

Body response from Twitter

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.

PowerAutomate condition

PowerAutomate condition

A condition is basically a true or false determination for a given property.

Click the Choose a value field.

Choose a value from dynamic content

Choose a value from dynamic content

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.

Search dynamic content

Search dynamic content

Select the in_reply_to_user_id item.

Select the middle dropdown item to view the options.

If value Is equal to

If value Is equal to

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.

Value is not equal to

Value is not equal to

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.

Flow bot

Flow bot

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

Post a Teams message

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.

Post to Teams

Post to 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.

Successful flow completion

Successful flow completion

2+
avatar

Poll: Does your organization plan to introduce Artifical Intelligence?

Read 4sysops without ads and for free by becoming a member!

7 Comments
  1. Matthew 1 month ago

    Fantastic example that makes it easy to visualise how I could use this capability. Thank you.

    1+
    avatar
  2. Robert,

    do you know if there is a possibility to somehow connect to monitoring systems like Nagios or Zabbix? Definitely its not listed in the tool, but could there be any workaround maybe?

    Cheers

    0

    • Author

      If they an an API then you can probably connect that way, however using APIs requires a premium PowerAutomate License.

      0

      • OK thanks, as I checked the supported API connector list, they are not listed.

        0

        • Author

          Perhaps not directly, but you can use the standard HTTP API to send requests to it if they have an API.

          For example Unifi Controllers have an API but not a supported API toolset in PowerAutomate, ZenDesk have an API that is available through PowerAutomate.

          0

  3. James Vandenbroek 1 month ago

    I did this exact process a few weeks ago myself (and I suspect many other admins have). It was my first time in PowerAutomate but I'm plenty familiar with putting together flows like this by hand. After how quick and easy it was, I was compelled to go further with the premium license in hand.

    First, before adding anything else, I post the original message to teams include the tweet ID in it.

    Then, using a quickly made dev account on Twitter so I could use their early access v2 api, I pull the conversation ID of the tweet after the built-in connector pulled it. The conversation ID is always the tweet ID of the original tweet in the twitter thread.

    From there, parse the JSON response appropriately. It's a single element array so I always just refer to the first element at all points forward (hope you like functions). Then in the condition structure that's determined the tweet is a reply, I check all posts in the teams channel for one that contains the same conversation id. Once found, I post the tweet as a reply to that message. Annoyingly you cannot post a reply as the flowbot at the moment so it will post as the user but otherwise it works like a champ.

    Here's a photo of the final product (a little extra formatting flair too).

    Teams Posts

    2+
    avataravatar
    • Al 2 weeks ago

      James, it is gone 😐

      the URL is no longer valid.

      0

Leave a reply

Your email address will not be published. Required fields are marked *

*

© 4sysops 2006 - 2020

CONTACT US

Please ask IT administration questions in the forums. Any other messages are welcome.

Sending

Log in with your credentials

or    

Forgot your details?

Create Account