# Where parallels cross

Interesting bits of life

# Microsoft (Teams) notifications in your Org Agenda (through Emacs Slack)

## Too long; didn't read

You can forward Microsoft notifications to Slack (as long you can access Power Automate). This way you can make your Org Agenda a dashboard for your Microsoft notifications.

## The problem

Ping! Ah, somebody is looking for me. Ping! there is a pull request to review. Ping! Oh, I need to reply my manager. And I got three important mails, aargh!

Well, that is a bad moment of my interactions with Microsoft technology at work...

Some time ago, I managed to seal my Slack distractions within my Org Agenda, but as Gerald Weinberg says: "Once you eliminate your number one problem, YOU promote number two". Notifications just ruin my focus and I get headache from cycling through all the clients/websites I need to keep an eye upon.

Still I need to be aware of them and react to them at some point.

## It is a problem indeed

And emails! I just prefer this medium over chats, but even another place where to look.

Unluckily for each of these I need to plugin a different piece of software and sometime this software does not even exist yet (for example, there is no Teams client for Emacs yet).

How amazing if I could just inject in my agenda all this work communication and deal with it at my own time? If it is really urgent I would receive a call anyway (also I look often at my agenda).

## And there is a solution

Then I heard a colleague mention how he automated a lot of his Microsoft workflows. He spoke of connectors and plugging in random services on the web. So I thought: do you want to see that I can forward Microsoft notifications to Slack?!

I asked him for a tutorial and: YES! You can forward both emails and chat notifications to Slack. Most of the steps are setup in the Microsoft platform, so I am going to explain them in pictures:

1. make sure you have access to https://emea.flow.microsoft.com/

This is Power Automate, the service that lets you integrate services.

2. I suggest to make a private channel on Slack where you can forward notifications

Note: Slack is a third-party tool, so if you forward your email there I suggest to include only the necessary data.

3. now browse to https://emea.flow.microsoft.com/
4. then click on Create in the left bar

5. choose Automated flow

6. select the trigger you want to use (let's start from Teams)

7. define flow details (i.e., specify from what team channel and to what slack channel)

Note: there is chance that your private channel is unavailable in the proposed target channel list. If so, just input the name manually selecting the last option in the list.

8. (optional) you can test your automated flow by clicking the "Test" button on the top right

I found it easier to test the email connector because for Teams you need to ask somebody to mention you in the Teams channel you selected. You can send emails to yourself though (I told you I like emails more).

9. Then save your flow and enjoy receiving notifications from your Slack private channel!

I have just tried a combination of forwarding of emails and Teams mentions for some channels and my notification stress has already gone down a lot!

Now for the Org mode power users: if you want to make these notifications show in your Org Agenda (as in here), you need another couple of steps.

1. In the flow definition you should add to the message body a mention to yourself (you know, the Slack's @username thingy) to make sure notifications reach Emacs Slack

You can write this like <@someId> and you can find your id through Emacs Slack with slack-user-select which will display information about the user, included their Slack id.

2. You need to modify Emacs Slack to receive private channel notifications, because the code seems broken for that:

Redefine slack-message-notify-p with the following definition in your init file.

(defun slack-message-notify-p (message room team)
(and (not (slack-message-minep message team))
(or (slack-im-p room)
(slack-group-p room)
(slack-room-subscribedp room team)
(slack-message-mentioned-p message team)

I needed to remove slack-mpim-p from the original definition because it was always returning nil, preventing notifications from happen.