S
S
Stuksus2019-09-11 18:48:09
Python
Stuksus, 2019-09-11 18:48:09

How to mention a conversation participant in a message via vk API?

I'm trying to send a message from the chatbot, which contains mentions of the participants in the conversation. Used the message.send method. Forms like [id|name], @ or * didn't work. Using domain does not change anything, maybe I'm using it incorrectly, if possible, please explain how it works
Code:

def write_msg(session,user_id, message,domain):
    rand=random.randint(-9223372036854775807,9223372036854775807)
    session.method('messages.send', {'peer_id': user_id,'random_id':rand ,'message': str(message),"domain":str(domain)})

I use the library: vk_api

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
Kirill Zver, 2019-09-12
@Stuksus

[id|name] should work - 100%. Do you specify exactly in the format: [id12312412|Vasya]?
What sends when it doesn't work?

A
Amigun, 2019-09-14
@Amigun

There are two ways to mention a user in a conversation:
Just send a message like this: @id_user (Hey Vasya)
Voila!

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question