Answer the question
In order to leave comments, you need to log in
How to send message via vk open api with client js?
Connected open api to the page
<script src="https://vk.com/js/api/openapi.js?154" type="text/javascript"></script>
<script type="text/javascript">
VK.init({
apiId: 12345
});
</script>
VK.Auth.login(r => {
if (r.session) {
resolve(r);
} else {
reject(r);
}
}, 4096);//это маска для получения доступа к сообщениям
VK.Api.call('messages.send', {user_id:123, message:"text", v: '5.80'}, function (r) {
if (r.error)
{
reject(r.error);
}
resolve(r);
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question