2
votes

Im trying to send a notification on a teams channel through bot via bot rest api ( bot has basic command to fetch some data as well ).

I am able to send normal text and/or cards.

since this will be a notification. I want to occasionally mark the message sent via bot to be "IMPORTANT" or Mention the a team

doing a POST call to api endpoint https://smba.trafficmanager.net/amer/v3/conversations (authorization already done and working correctly)

I am able to send just normal text activity. such as this one

{
    "isGroup": true,
    "activity" : {
        "type": "message", 
        "text": "Hey check out this message"
    },
    "channelData": {
        "teamsChannelId": "19:[email protected]"
    }
}

sending this just makes the text blue color and doesn't actually "mentions" the group nor mark it "important"

{
    "isGroup": true,
    "activity" : {
        "importance": "high",
        "type": "message", 
        "text": "Hey <at>test team</at> check out this message",
        "entities": [
            {
                "type":"mention",
                "mentioned":{
                    "id":"19:[email protected]",
                    "name":"test team"
                },
                "text": "<at>test team</at>"
            }
        ]
    },
    "channelData": {
        "teamsChannelId": "19:[email protected]"
    }
}

is there a way to do this via bot api?

1

1 Answers

0
votes

Regarding @mentioning teams and channels, it currently isn't possible. You can track progress here.

Regarding setting importance, as far as I can tell, it currently isn't possible. If somebody from the MS Teams team wants to chime in, that would be appreciated (I'm from the bot team).

I tested both of these extensively through Node and C# SDKs as well as the REST API. I could be missing something, but I'm fairly certain this isn't currently possible. That being said, you should be able to @mention each user after getting a list of users on the team.