Answer the question
In order to leave comments, you need to log in
How to send a VK message on your own behalf (not from a group)?
I can’t find in Google how to send a message on my own behalf, everywhere only on behalf of the group
import vk_api
import json
# Настройки
login = "логин"
password = "пароль"
# Вход в вк
vk_session = vk_api.VkApi(login, password)
vk_session.auth()
vk = vk_session.get_api()
# Отправка сообщений
user_id = 546345252
msg = "Привет"
vk.messages.send(user_id=user_id, message=msg, random_id = 0)
vk_api.exceptions.ApiError: [15] Access denied: no access to call this method
Answer the question
In order to leave comments, you need to log in
Getting a token via Kate Mobile on vkhost.github.io
import vk_api
token = ""
user_id = 1 # type: int
vk = vk_api.VkApi(token=token).get_api()
vk.messages.send(
user_id=user_id
message=0
random_id=0
)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question