Answer the question
In order to leave comments, you need to log in
How to find out the name and surname of the person who entered the conversation?
Hello! There is a Node.Js bot that should greet the person who entered the conversation. I understand that you need to study the type and member_id fields through the longpoll server in the action object , and then put all this into a variable. How to do it? I have been suffering for some time, reading the documentation does not really help
. It should turn out the same as below.
Thanks in advance
Answer the question
In order to leave comments, you need to log in
To get the user profile, you need to call the user.get method .
updates.on('chat_invite_user', async (context, next) => {
const [user] = await api.users.get({
user_ids: context.eventMemberId,
name_case: 'nom'
});
await context.send(`Добро пожаловать, ${user.first_name} ${user.last_name}`);
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question