Examples: query, "exact match", wildcard*, wild?ard, wild*rd
Fuzzy search: cake~ (finds cakes, bake)
Term boost: "red velvet"^4, chocolate^2
Field grouping: tags:(+work -"fun-stuff")
Escape special characters +-&|!(){}[]^"~*?:\ - e.g. \+ \* \!
Range search: properties.timestamp:[1587729413488 TO *] (inclusive), properties.title:{A TO Z}(excluding A and Z)
Combinations: chocolate AND vanilla, chocolate OR vanilla, (chocolate OR vanilla) NOT "vanilla pudding"
Field search: properties.title:"The Title" AND text
Answered
Any ability to capture @someone and store it into a variable?

Hello guys, we leverage a bot function that allows us to /ping @"someone in the company" where "someone in the company" is replaced by a firstname lastname discovered automatically by symphony.

Is there any ability for us to capture the @username into a variable? I'm thinking it would be user_details.user_attributes.display_name from the UserService but wondering if anyone has any other ideas on how this would be done?

The end goal would be to be able to /send @someone in the company and be able to replay the user's name. We'd also want to do some type of validation to make sure it's an actual user because right now we have a regex that just captures anything @someone and it's not ideal since it can be spoofed.

Thanks!

1
1
Posted one year ago
Edited one year ago
Votes Newest

Answers


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.

1
1
Posted one year ago
Edited one year ago
Yong Sheng Tan
39 × 2 Administrator
  
  

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!

dk   one year ago Report
  
  

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

dk   one year ago Report
1K Views
1 Answer
one year ago
one year ago
Tags