GMAC
GMAC

Reputation: 868

Microsoft Graph API - send message in channel by using team tagging

This graph API send a message in the channel

POST https://graph.microsoft.com/v1.0/teams/{team-id}/channels/{channel-id}/messages

{
    "body": {
        "content": "Hello world"
    }
}

Also, following the docs from https://learn.microsoft.com/en-us/graph/api/resources/chatmessagemention?view=graph-rest-1.0 I can mention user, channel or team

But I am looking for how I can mention Tags while sending message in a channel.

Upvotes: 0

Views: 1603

Answers (1)

GMAC
GMAC

Reputation: 868

After doing some research, came up with a solution thought of posting here for others:

Graph API

POST https://graph.microsoft.com/v1.0/teams/{team-id}/channels/{channel-id}/messages

Body here is critical

{
    "subject": "This is very urgent!",
    "importance": "urgent",
    "body": {
        "contentType": "html",
        "content": "Programatically mentioning of Tagged users  <at id=\"0\">String_1234</at>"
    },
    "mentions": [
        {
            "id": 0,
            "mentionText": "String_1234",
            "mentioned": {
                "tag": {
                    "@odata.type": "#microsoft.graph.teamworkTagIdentity",
                    "id": "",         //tag id
                    "displayName": "" //tag name
                }
            }
        }
    ]
}

Upvotes: 2

Related Questions