I checked the samples/API references here:
But cannot find how to mention someone in a new message to a channel.
Mention teammates The member(s) won't be notified, but you'll have the option to invite them to the channel or do nothing. The member(s) won't be notified or allowed to join the conversation.
An @mention is like a tap on the shoulder—a way to get someone's attention in a channel conversation or a chat. In the box where you type your message, type @, then type the first few letters of the person's name. You can also @mention entire teams and channels. Select the person.
DMs can be one-to-one, or they can include up to nine people. Starting and sending DMs is just like writing any other messages in Slack. Learn how to send and read messages.
Sorry this was never answered. This feature was added months ago - there are SDK methods called addMentionToText (Node.js) and AddMentionToText (C#) - source and usage samples here.
There's also an example here that's actually a bit more helpful. That example bot can be run very quickly on Glitch - repo and instructions are here.
Note that one of the challenges in using this API is that you have to have the user ID of the person you want to @ mention, and for that you need the team roster. Examples of how to do that are here.
Programmatic @mentions are not currently supported by Microsoft Teams, and will probably not come soon.
There is such a wish from the community in the MS uservoice portal, but it seems not to burn as much as other issues:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With