U
U
ultango2019-11-29 17:02:03
JavaScript
ultango, 2019-11-29 17:02:03

How to check for a new message in a community using vk-io?

There is this code written with vk-io :

const vk = new VK({
    token: 'TOKEN',
})

vk.updates.on('message_new', (context) => {

    console.log(context)

})

vk.updates.start().catch(console.error)

As follows from this passage, after sending a message to the VK community, output the result to the console. But it doesn't work ( ͡° ͜ʖ ͡°)
In the community itself, the correct version of the Longpoll API is enabled and configured to receive messages.
What could be the problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladlen Hellsite, 2019-12-01
@ultango

const vk = new VK({
    token: 'TOKEN',
})

vk.updates.on('new_message', (context) => {

    console.log(context)

})

vk.updates.start().catch(console.error)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question