How to create a personal “read this” task for every message added to a channel in Teams

I wrote earlier about adding a ToDo or a Planner task every time you are mentioned in a specific channel. This was to cope with situations where you are being mentioned so much that you can’t follow your atmention notifications anymore.

Another, a bit similar but usually purely personal, matter is to keep track of messages written to specific channels. Most of the people just use channel notifications (set for all new messages) but in a situation where you are still getting too many notifications that won’t be the answer. Examples of these can be news/announcements, updates to instructions, changes to practices etc. These also work the best when those channels either have a moderation in place or they don’t get that much messages that are not related to the matter.

The natural place for these is usually your personal ToDo (I need to read these later) but in some cases a Team level Planner is a good option if that is a team task – not a personal one. Look to the post mentioned in the beginning of this post how to add these tasks to a team Planner.

Let’s add automation to it

We can of course do this with Power Automate. And as it happens there is (and have been a long time) a trigger that can help with this one. “When a new channel message is added”

Choose the team and the channel you want to follow with this one.

You need to create a link to that message, to make it easy to find it directly from the task. Choose any existing message on the channel and get a link to it via message’s … menu and clicking on Copy link.

👉 Alternatively: you can check out “Improvements” section at the end of this blog post to read how you can use Parse JSON action to get URL directly from the message and use that one. It will also make this Flow easier to add to other channels and teams. 👈

From the link text you need to choose the beginning and the middle part. For details in this : check out again the earlier post mentioned in the beginning of this article. You need to initialize three variables (type String) Link part 1, Link part 2 and Link to message.

In technical terms the first part is the https://teams.microsoft.com/l/message/{channelid}/ and the second part is ?tenantId={tenantid}&groupId={teamid}&parentMessageId=

For Link to Message Value you hit Fx in the right and enter a formula. I also walked through the steps in the earlier post but this time you choose the “Message id” from the section “When a channel message is added”

concat(variables('Link part 1'),triggerBody()?['id'],variables('Link part 2'),triggerBody()?['id'])

Add Html to text -action and add Message body content to it via the lightning icon (add dynamic value).

You will then add “Add a to-do (V2)” action and set it’s values. First you need to switch to the code view to enter Body content.

Subject usually has something like “Read this” and it is followed by the message subject and the text so you can easily see what it is about. Since these are more important posts you may want to set Importance to High and set also the correct To-do List you want to use.

The Body content can be freely formed otherwise but you want to add a link to specific URL there. URL is stored in the variable Link to Message and you can add it via the lightning (add dynamic value) icon.

Note: if you switch off from the code view or close the section and reopen it the html code does not look correct. I have a habit of fixing that every time so I don’t open the section unless I want to do changes.

Save it and you are ready! It doesn’t look that bad, doesn’t it?

Testing

Let’s add a message to the channel to test this one.

Looking at the Flow run history we can see it succeeded.

But that is not that interesting. The actual beef is that the task has appeared to my ToDo with information about the channel post.

And if I open it I can see it’s info

And clicking the “Link to message” opens the right message in Teams and highlights it for a moment! Success!

The drawback in this one too is that you need to create copies of this Flow to use it in other channels. I recommend using this only

  • when you know you are missing important information in notifications
  • there are channels that contain messages that you must read and act upon

Better solution is usually to reduce the number of notifications you get. But you can use this to improve your productivity and reduce the stress of missing something important that must read.

Improvements

There are of course always room for improvement. Some ideas

  • Put more information about the message into the Body Content so you get the essential via ToDo alone. This depends on the content of course.
  • Use this in projects to stay up to date about recent messages – perhaps sent to a team channel via email
  • Use information you get from the action “When a new channel message is added” to decide whether it is worthy of a ToDo task.
    • Use Parse JSON to retrieve information directly from the message. This way you can get webUrl to the message easier making it a real simple flow.
    • importance (for example: add to ToDo only if the message is marked important)
    • locale (en-us, for example)
    • User who wrote the message (id and name)

Add Parse JSON

Use Generate from sample to create a schema. You get a message by looking into this flow’s run history and choosing the output of the trigger (When a new channel message is added). Or you can this one – however, it can cause issues since I haven’t added any null checking there. That schema also shows what information you have at your disposal later in the Flow. Using this instead of parsing URL together manually can be useful if you are planning to reuse this flow in different channels. Then you only need to change team/channel in the trigger.

{
    "type": "object",
    "properties": {
        "@@odata.type": {
            "type": "string"
        },
        "replyToId": {},
        "etag": {
            "type": "string"
        },
        "messageType": {
            "type": "string"
        },
        "createdDateTime": {
            "type": "string"
        },
        "lastModifiedDateTime": {},
        "deletedDateTime": {},
        "subject": {
            "type": "string"
        },
        "summary": {},
        "importance": {
            "type": "string"
        },
        "locale": {
            "type": "string"
        },
        "webUrl": {
            "type": "string"
        },
        "policyViolation": {},
        "id": {
            "type": "string"
        },
        "from": {
            "type": "object",
            "properties": {
                "application": {},
                "device": {},
                "conversation": {},
                "user": {
                    "type": "object",
                    "properties": {
                        "id": {
                            "type": "string"
                        },
                        "displayName": {
                            "type": "string"
                        },
                        "userIdentityType": {
                            "type": "string"
                        }
                    }
                }
            }
        },
        "body": {
            "type": "object",
            "properties": {
                "contentType": {
                    "type": "string"
                },
                "content": {
                    "type": "string"
                }
            }
        },
        "attachments": {
            "type": "array"
        },
        "mentions": {
            "type": "array"
        },
        "reactions": {
            "type": "array"
        }
    }
}

Now it does look simple, doesn’t it? And it still contains the URL to the message

After some final touches the Body content could look like this to give you an idea how to use the information gotten via Parse JSON. Those fields are added via the dynamic value (lightning icon) like any other information.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.