mention_user() turns a canonical human identity into the platform’s native @mention, so the right person gets a real ping in a shared channel.
Here’s a real example: a deploy agent posts in #deploys (Slack), where Alice, Bob and the bot are all members. Bob is on call:
Quick Start
1
Mention someone by canonical id
Link the human once in an identity resolver, then pass the same resolver to
Bot. Once the bot starts, bot.adapter.mention_user("alice") returns the native markup.2
Fallback when the person isn't linked here
If the person has no link on this platform, you get the id back as plain text. Your message still goes out; it just doesn’t ping anyone.
3
Use the unlinked platform:id shortcut
If you already know this platform’s native id, pass
"{platform}:{native_id}". The bot skips the resolver.How It Works
- If the platform has no mention template, it can’t ping by id, so the id comes back as plain text.
- A
"{platform}:{native_id}"id whose prefix matches this adapter is rendered directly. The resolver isn’t called. - Otherwise the adapter calls
links_for()on its identity resolver.Bot,BotOSand the gateway attach the resolver automatically. - The adapter uses the link for its own platform to render the mention, for example
<@222>. - If there’s no link for this platform, or the lookup raises, the id comes back as plain text. A lookup error is logged as a warning and the reply is never lost.
Which form do I pass?
Configuration Options
There is nothing to configure:mention_user(unified_user_id) takes a single argument and returns a string. Full API: Bots SDK reference.
Common Patterns
Handoff pingBest Practices
Prefer canonical ids over raw native ids
Prefer canonical ids over raw native ids
Pass
"alice", not "222". The same agent code then works unchanged on Slack, Discord, or any other channel.The plain-text fallback is a feature
The plain-text fallback is a feature
If someone isn’t paired on this platform, they’re named in plain text. The message is still delivered and nothing crashes.
Pair the human first
Pair the human first
A canonical id only becomes a native mention after it’s linked. See Bot Pairing to set up the links.
Don't write raw <@id> markup yourself
Don't write raw <@id> markup yourself
Let
mention_user() produce the markup. Each adapter owns its template, so you can swap platforms without changing your code.Related
Bot Pairing
How a human becomes a canonical identity
Identity Canonicalization
The identity map the resolver reads
Implicit Mentions
The inbound counterpart
Bot Gateway
Where channel adapters are wired

