Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

username from message #69

Closed
mradamfrancis opened this issue Jan 30, 2017 · 2 comments
Closed

username from message #69

mradamfrancis opened this issue Jan 30, 2017 · 2 comments

Comments

@mradamfrancis
Copy link

Is there a way to get the name of the user who enters a message? I can get msg.body.event.user, which is the user id, but I want something meaningful as part of the bot's response

@selfcontained
Copy link
Contributor

The message from Slack will only have the user id, but you can take advantage of Slack's message formatting and it will automatically convert a formatted user link into their name. For example, if you sent the following string in your response, it would be converted to a link that is the user's @name.

<@U024BE7LH>

More about that here: https://api.slack.com/docs/message-formatting#linking_to_channels_and_users

If you need the username, you can always do an api lookup using the users.info call.

@mradamfrancis
Copy link
Author

sweet thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants