S
S
senyadev02018-10-27 19:10:49
Python
senyadev0, 2018-10-27 19:10:49

[15] Access denied when using messages.getHistory on behalf of the community, what should I do?

I'm making a chat bot using the vk_api library for Python.
When trying to get the name of the conversation, the number of messages and the number of participants, it gives an error [15] Access denied.
I use longpoll, the latest version, I gave out all the rights. The code is below.

chat = vk.messages.getHistory(peer_id = event.obj.peer_id,count = 0,extended = 1)
chattitle = chat[0]['chat_settings'][0]["title"]
chatmsgcount = chat[0]["count"]
chatmembercount = chat[0]['chat_settings'][0]["members_count"]

count = 0 to get only information about the conversation, not the last message.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Stockholm Syndrome, 2018-10-27
@senyadev0

bot communities do not save the history of correspondence in conversations, so all messages have id = 0 and the method cannot be called

B
bqio, 2018-10-27
@bqio

Check all tokens and access again.
5bd490538a4f9934827106.png

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question