Coder Social home page Coder Social logo

Identifying a user about botkit HOT 12 CLOSED

howdyai avatar howdyai commented on May 12, 2024
Identifying a user

from botkit.

Comments (12)

ding444 avatar ding444 commented on May 12, 2024 20

@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.

djanowski avatar djanowski commented on May 12, 2024 10

(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.

benbrown avatar benbrown commented on May 12, 2024

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.

chriskinsman avatar chriskinsman commented on May 12, 2024

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.

Shubhamjain112 avatar Shubhamjain112 commented on May 12, 2024

How do I get the user name through bot.api.users.info() ?

from botkit.

lucaskatayama avatar lucaskatayama commented on May 12, 2024

I got

{ ok: false, error: 'not_authed' }

I added users:read to the scope... but still not_auth...

from botkit.

littleStudent avatar littleStudent commented on May 12, 2024

same problem here. users:read added to the scope. still getting not_authed error

from botkit.

hannesjung avatar hannesjung commented on May 12, 2024

same for me, did you find a fix?

from botkit.

littleStudent avatar littleStudent commented on May 12, 2024

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.

azizimranz avatar azizimranz commented on May 12, 2024

Hi,

I want the bot to hear from only specific user.

(Its drift user that I want to hear only).

from botkit.

artur79 avatar artur79 commented on May 12, 2024

(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.

EitanK96 avatar EitanK96 commented on May 12, 2024

@artur79 , did you manage to solve this because i am also trying the same thing that you wanted

from botkit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.