Unanswered
From your use of underscores, I assume you're using the Python BDK.
You can use the slash command decorator and include an @mention as an argument in your pattern.
https://symphony-bdk-python.finos.org/markdown/activity-api.html#slash-command-pattern-format
For example,
@activities.slash("/ping {@person}")
async def on_echo_mention(context: CommandContext):
person = context.arguments.get_mention("person")
name = person.user_display_name
uid = person.user_id
await bdk.messages().send_message(context.stream_id, f"Hello <mention uid=\"{uid}\" />")
There's no need to do any validation since an @mention will always resolve to an actual user. However, this could be either an internal or external user - so be wary of using the user id immediately to create a new IM and send a message if your bot isn't connected to the external user.
3K Views
0
Answers
2 years ago
2 years ago
Hey @Yong Sheng Tan, Thanks for answering this. Super helpful and I did not know about this capability. I'll give it a shot and report back here with issues. Thanks again!
Actually I was playing with this today and it came out in the 2.4.0 release. I posted here about some of the shortcomings I ran into with it: https://github.com/finos/symphony-bdk-python/issues/303