It's time to focus: How to sync your Apple focus mode with Teams


Everyone using an iPhone knows the feature "focus mode". In this article we'll show you how to sync your Apple focus feature with Microsoft Teams.





If you're using an iPhone, you might know the build-in focus mode which was introduced with iOS15 in late 2021. The idea is simple: Set a focus mode and don't get distracted by calls, apps or any other notification we all "love" to have all day. Apple offers different variations. You can choose between the following modes to suit most of your daily needs:

  • Sleep

  • Work

  • Fitness

  • Do Not Disturb

  • Personal

E.g. in the "work mode", calls and mails are allowed, but your daily reminder to see someone others Instagram posts is waiting until "work mode" is off.


Check out the Apple User Guide to get more detailed information about this feature.



Benfits of the focus mode: synchronisation and automation

One of the biggest advantages of "focus mode" is the synchronisation with all your Apple devices: If you switch on "Do Not Disturb", this focus mode is immediately synced to all your devices and you won't get notifications on your iPad, AppleWatch or Mac!


Automations can help to improve your configurations. Every time you'll start a workout (e.g. go for a run or swim), the focus mode will automatically switch to the "fitness mode". This means that only your VIP contacts can reach you while all other notifications are blocked. This is really a great feature which helps to relax and improves your mindfulness in a simple and easy way.


You can find this setting on your iphone here: Settings -> Focus -> Fitness:




Presence modes in Microsoft Teams

in2success is a 100% remote company which means that we are always connected via the Microsoft 365 Cloud. We have the opportunity to work from anywhere we want because we don't have a big office where we all need to commute to in the morning, sit on our desks and work together. Instead of this we have a small office we can use for workshops, customer meetings or events.

One of our main (and best) collaboration tools in our daily work is Microsoft Teams. Teams offers you different presence modes too, including options from "Available" to "Appear Offline". There are also some more options you can choose manually. When you're in a conference or call for example, your presence is set to "In a Call".


Personally, we are a big fan of the "Do Not Disturb" status which blocks calls and message notifications during times when we want to concentrate on our work, e.g. during a Pomodoro session.





At this point you may have already figured out that we're living between two worlds – the Apple universe with its focus modes and during our working day in the Microsoft universe. This circumstances forced us to search online for a way to connect these two worlds. This should be an easy win you may think? Actually, finding an answear was not that easy.



How to solve the problem

Because we do have a sense for tech stuff, we tried to figure it out by our own.There's one thing we've learned during this "project": There are a lot of ways to achieve, but some of them are quite complex! You'll see later on why.


But at the beginning we have to admit that we got a lot of help from different sources all over the internet. As we wanted to start things easy, we decided to go with the following MVP approach:

Setting my Apple Do Not Disturb Focus Mode toggles my Microsoft Teams presence to Do Not Disturb --> (one-way)

While reading this you might think that we've already succeeded, but you're wrong. If you have a solution which might be easier or you did the sync the other way round, please let us know! We'd love to link your approach here!


Basically, our solution approach works in 2 simple steps:

  1. After selecting the "Do Not Disturb" focus mode a web hook will be triggered.

  2. The web hook trigger starts a Power Automate Flow setting the Teams presence to "Do Not Disturb".

Starting with the last one, you have to be eligible to use Power Automate Premium Connectors. In case you're the kind of person who's really into the licensing part of Microsoft, feel free to read here all the details. Otherwise we suggest you to try if the following instructions works for you:




Give your flow a name (e.g. "Set Teams presence to Do Not Disturb") and select "When an http request is received" in the list of triggers and complete with "Create".


Then select "Next step", enter the word "Sharepoint" into the search field and click "Send an HTTP request to SharePoint".





Now it's time to take a look on these values:

Site Address: https://presence.teams.microsoft.com
Method: PUT
Uri: /v1/me/forceavailability
Header key: content-type 
Header value: application/json

Fill the body with the following JSON to set the teams presence to "Do Not Disturb":

{

"availability":"DoNotDisturb"

}

You might rename this step. We chose "Teams to DND".



Every time you'll receive some error messages like these, just select the save button twice (or more often) so you can proceed in the process.


You can change your "availability" status in the body of the flow to "Available", "Busy", "BeRightBack", "DoNotDisturb" or "Away".


Thanks to DamoBird365 for this hint for all US guys:

You are in the USA or using a US tenant? You might need to use https://noamdf.presence.teams.microsoft.com or https://presence.gcc.teams.microsoft.com or you will get a Status 301 error when the action runs.

In case you want to change your status message within Teams via this flow as well, check out DamoBird365s' article.


Once you hit the save button (or as mentioned before maybe even several times), you'll receive a green framed message. Now you can click on the first step "When an HTTP request is received" to retrieve the URL you know and copy it.



Select "Test" in the top right corner next and set the manual trigger.


If you're familiar with setting a HTTP POST request using e.g. Postman or Powershell, please feel free to do this. Because we wanted to do this with the Apple tools, we started using the shortcuts app you can find on iOS or macOs.



Working with the shortcut app

First of all open the shortcuts app and hit the "+" icon to create a new shortcut. Select "+ Add Action", search for "URL" and select it.



Paste the URL from the flow created above.


The next action is "Get Contents of URL", expand it and change the method to POST. Give the shortcut a name and run it.


Now you'll receive a privacy popup which asks for permission you should allow if you want to proceed.



In case you made it so far and everything is working as expected – well done and congratulations! You should see a green confirmation message within Power Automate like this one:




Now it's time to consider redoing all the steps if you want to set up another flow or to set the presence status back to "Available" for example. You might have a different approach or solution. If you have other ideas please let us know! We're really looking forward to learn something new.



Automation: where the magic happens

Maybe you'll agree with us that automation is where the magic happens, right? If you want to automate our workflow, you'll need the Apple shortcut app again. But this time only the iOS version is able to achieve the requested action (what a pity!).


Step one: Select "Automation" and create a new personal automation. Then scroll down to the focus section and select the focus mode you want to use, e.g. "Do Not Disturb" like in the following screenshot:



Now search for "Run Shortcut" and select it:



Choose your created shortcut and set the toggle "Ask before running" off. Otherwise the automation part is really missing the "magic":



You can now see your automation. Everything is set up, so let it run. Switch your focus mode to "Do Not Disturb" (or whatever you've set in your configuration).


Because we have two flows (one for "Do Not Disturb" and one for "Available") and two shortcuts, we've set up another automation which triggers as soon as we switch off the "Do Not Disturb" mode. As a consultant, you may have multiple tenants where you can redo those steps, so we did it in one of our customer tenants as well.


And that's it. Let us know if this article was useful for you!







Follow us
  • Xing Icon
  • LinkedIn - Weiß, Kreis,
  • Twitter - Weiß, Kreis,
  • Facebook - Weiß, Kreis,
  • YouTube - Weiß, Kreis,