How can I get the user name from slack?

Hi there! I just making a bot using Botkit studio from howdy and using Glitch to storage the code bot. I made a Mongo database in order to save the answers of the users. What I want to do now is to get the username and not only the ID user. Is there any way to do that?

I’ve tried this but I saw “undefined” in the console message:

var{user: message.user});

It looks like you can do it using:{user: message.user}, (error, response) => {
    let {name, real_name} = response.user;
    console.log(name, real_name);


Hi Gareth!,

Many thanks for your answer. The code works! That’s good to not force the user to write their names again. By the way, is there any way to save that data in a variable?

Thanks again for your help!.


1 Like