Comments (12)
@Shubhamjain112, it's late to the game but this is how I've done it:
controller.hears('hello', ['direct_mention'], (bot, message) => {
bot.api.users.info({user: message.user}, (error, response) => {
let {name, real_name} = response.user;
console.log(name, real_name);
})
})
from botkit.
(For people finding this issue via Google:)
If you just want to mention the user, you don't need to query the users API to get the handle.
Format the message like this: Hello <@${user}>
. Slack will turn the ID into a proper mention.
from botkit.
Sounds like you want to get the name of the user from Slack. Am I right?
For this, you would use bot.api.users.info()
from botkit.
Yep. Just thought there would be a method backed by storage that would identify the user from storage and only make the call if needed. I added one. Will look at a pull request..
from botkit.
How do I get the user name through bot.api.users.info() ?
from botkit.
I got
{ ok: false, error: 'not_authed' }
I added users:read
to the scope... but still not_auth...
from botkit.
same problem here. users:read
added to the scope. still getting not_authed
error
from botkit.
same for me, did you find a fix?
from botkit.
I could not figure out how to get the user...
I used this package just for getting the list of users https://www.npmjs.com/package/slackbots
from botkit.
Hi,
I want the bot to hear from only specific user.
(Its drift user that I want to hear only).
from botkit.
(For people finding this issue via Google:)
If you just want to mention the user, you don't need to query the users API to get the handle.
Format the message like this:
Hello <@${user}>
. Slack will turn the ID into a proper mention.
what if I'v got user id and I don't want to get mention, just name ?
from botkit.
@artur79 , did you manage to solve this because i am also trying the same thing that you wanted
from botkit.
Related Issues (20)
- How to recover from a BotFrameworkAdapter message rejection (401 error)? HOT 7
- MS Teams: Property 'api' does not exist on type 'BotWorker' HOT 10
- Send proactive message on MS teams HOT 2
- botkit 4.15.0 and Webex Adapter 1.0.10 are not on NPM HOT 1
- How to upload this Bot to Teams? HOT 2
- Bot can send, but not receive anymore HOT 2
- Botkit Webex API client not returning data HOT 1
- Question: Handling Websocket terminations HOT 1
- Uncatchable throws on botbuilder-adapter-webex registerWebhookSubscription Functions HOT 19
- Conversation become "duplicated" when running long operation HOT 1
- Help in Implementing the B2C Chatbot
- Webex Teams Adapter Doesn't Support direct_mention Event Type
- ☺
- BotkitConversation not executing when using axios but its executing fine when calling inside request?
- Cannot read property '1' of undefined
- Block Action Issue (when 'Clear Selection' is clicked)
- Can I message a pages followers with this??
- Remove deprecated request package
- Is project Dead? HOT 2
- Botkit
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from botkit.