How to mention a user/group in a new message to a channel?

Holger picture Holger · Jan 3, 2017 · Viewed 8.3k times · Source

I checked the samples/API references here:

But cannot find how to mention someone in a new message to a channel.

Answer

Bill Bliss - MSFT picture Bill Bliss - MSFT · Sep 22, 2017

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.