Treg's blog

July 27th, 2023

Automate MSFT Teams Presence and Status Messages

Posted by Treg in Howto's

Recently, the organization I work for moved from Slack to Teams as their primary communication platform. Ever since, I try to adapt my working style, but some (mainly chat) features are lacking. 😬

One of the key features I use, are custom status messages. This to keep my colleagues informed about my availability.

Setting a custom presence, a custom location and custom status message a few times a day is very cumbersome and time consuming. That’s where I started researching possibilities.

Very quickly, I found a few forum and blog posts around setting up Microsoft Power Automate flows to achieve these goals. A big ‘PRO’ is that you can run these flows directly as your Office 365 user since you are already authenticated towards the O365 ecosystem.
Additionally, with the ‘Power Automate’ application on you phone, you can run such flows as ‘Instant Flows’, which make this very convenient.

Pre-requirement: being enrolled in Office 365 with the ability to use Power Automate.

To start, open Power Automate and add a new flow by clicking on the “New Flow” button and selecting the “Instant cloud flow” option.

Change Status / Presence

Add a new step to a Power Automate flow.
Choose “Send an HTTP request to SharePoint”.

Configure the HTTP request as follows:

  • Site Address: https://presence.teams.microsoft.com
  • Method: PUT
  • Uri: /v1/me/forceavailability
  • Headers: 'content-type' → 'application/json'
  • Body:
    {
    "availability": "Away"
    }

The availability can be set to one of the following statusses:

  • Available
  • Busy
  • DoNotDisturb
  • BeRightBack
  • Away
  • Offline

Change Status Message

Add a new step to a Power Automate flow.
Choose “Send an HTTP request to SharePoint”.

Configure the HTTP request as follows:

  • Site Address: https://presence.teams.microsoft.com
  • Method: PUT
  • Uri: /v1/me/publishnote
  • Headers: 'content-type' → 'application/json'
  • Body:
    {
    "message": "I am working from home."
    }
  • Body with expiration timing for the status message:
    {
    "message": "I am working from home."

    "expiration": "2023-08-01T00:00:00.000Z"
    }

Attention, the expiration date is in ISO8601 format.

Change Location

Add a new step to a Power Automate flow.
Choose “Send an HTTP request to SharePoint”.

Configure the HTTP request as follows:

  • Site Address: https://presence.teams.microsoft.com
  • Method: PUT
  • Uri: /v1/me/workLocation
  • Headers: 'content-type' → 'application/json'
  • Body:
    {
    "location": "1"
    }

A location can contain the following configuration:

  • “0”: Not set
  • “1”: Office
  • “2”: Remote