Power Platform中心だけど、ノーコード/ローコード系を書いてます。

Post a teams message with Tag mention from Power Automate

Posting a teams channel message with Tag mention is achieved using Graph API via flow with following Url<teamId>/channels/<channelId>/messages

and request body (See Ref. Mention a tag with a flow – Expiscornovus from Dennis )

    "body": {
        "content": "Test message <at id=\"0\">SomeTagName</at>. ",
        "contentType": "html"
    "mentions": [
            "id": 0,
            "mentionText": "SomeTagName",
            "mentioned": {
                "tag": {
                    "id": "YABCDEFk5N2EtNjQzZC00MDA3LWEyZTUtNmVjOWM1YWI4NWNiIyM3ODdkMzVhMC0yZWU1LTQ5YzYtYWVkZC1mZDkzYmM0NDlkZDEjI3RrSU1TdGNpMg==",
                    "displayName": "SomeTagName"

Mention block in content <at ...>...</at>, mentionText , and displayName of Tag are easily obtained from Teams UI - name of Tag.

The last piece to build a request body is id of Tag (YABC...kjI3RrSU1TdGNpMg==).

In this post, I will show how to dynamically generate this ID and post message with Tag mention in Power Automate.

How to get Tag IDs via Teams API

As Damien shared in his blog post (Teams Status Update via Power Automate - DamoBird365), undocumented Teams API can be called from Power Automate by leveraging "Send HTTP request to SharePoint" action.

Tag IDs are also retrieved through Teams API with following Url:

GET<General Channel ID>/tagCards?tagType=any

Response body contains detail information about Tag in given team.

  "tagCards": [
      "tagId": "tkIMAtci2",
      "tagName": "Test Tag",
      "memberIds": [
      "memberCount": 2,
      "tagType": "team",
      "currentMemberIsPartOfTag": true,
      "scheduledMembers": [],
      "version": 1
  "teamTagSettings": {
    "onlyOwnersCanUpdate": true,
    "tagCount": 1,
    "disallowedSources": [],
    "version": 1

This response body does indeed contain a "tagId", but it is easy to see that this is not what we expect (like YABC...kjI3RrSU1TdGNpMg==).

Actually, this "tagId" is part of the lengthy id needed for the mention, which needs to be reformatted into the following and further base64 encoded.


Flow seup

The flow retrieving Tag ID via API and building TagID includes several Compose action to define TenantID, TeamID, ChannelID, TagName, and TagID.


If you want to try this flow, you can download sample flow from my github repo 👇

Please replace each IDs and Tag name with your environment's.

That's all!