F
F
Floydreme2018-08-20 18:43:59
In contact with
Floydreme, 2018-08-20 18:43:59

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
5b7adfab88a90500554219.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladlen Hellsite, 2018-08-21
@FloydReme

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 question

Ask a Question

731 491 924 answers to any question