
Security News
How Enterprise Security Is Adapting to AI-Accelerated Threats
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.
node-vk-bot-sdk
Advanced tools
Небольшое SDK для создания чат-ботов с использованием Node.JS на платформе сообществ ВКонтакте.
Рекомендуется использовать с версиями VK API выше 5.103.
$ npm install node-vk-bot-sdk
или
$ yarn add node-vk-bot-sdk
const express = require('express');
const { VkBotSdk } = require('node-vk-bot-sdk');
const app = express();
const sdk = new VkBotSdk({
group_id: 0,
secret: '',
confirmation: '',
access_token: ''
});
const bot = sdk.getCallback();
bot.command(/test/, (ctx, params) => {
ctx.reply(`reply to ${ctx.from_id}`);
});
bot.defaultReply((ctx, params) => {
ctx.reply('Default reply');
});
app.use(express.json());
app.all('/callback', bot.eventsCallback);
app.listen(8080);
| Значение | Тип | Описание |
|---|---|---|
| ctx.event | string | Тип полученного события |
| ctx.data | object | Полученные данные в событии |
| ctx.group_id | number | ID сообщества |
| ctx.event_id | number | ID события |
| ctx.user_id | number | Псевдоним для ctx.from_id |
| ctx.from_id | number | ID автора сообщения (ID затрагиваемого пользователя для других событий) |
| ctx.peer_id | number | ID дилога (ID затрагиваемого пользователя события для других событий) |
| ctx.message | string | Преобразованный текст сообщения (пустая строка для других событий) |
| ctx.orig_message | string | Оригинальный текст сообщения |
| ctx.client_info | object | Данные о клиенте пользователя или стандартный объект |
| ctx.reply(text, attachment, keyboard) | function | Отправляет ответ с текстом, вложениями и клавиатурой |
| ctx.replyKeyboard(text, keyboard) | function | Отправляет ответ с текстом и клавиатурой |
| ctx.replyAttachment(attachment) | function | Отправляет ответ только с вложениями |
| ctx.replyCustom(params) | function | Отправляет ответ с кастомными параметрами |
| ctx.isKeyboardSupported() | function | Возвращает информацию из client_info |
| ctx.isInlineKeyboardSupported() | function | Возвращает информацию из client_info |
| ctx.isCarouselSupported() | function | Возвращает информацию из client_info |
FAQs
A simple bot SDK for vk.com
The npm package node-vk-bot-sdk receives a total of 0 weekly downloads. As such, node-vk-bot-sdk popularity was classified as not popular.
We found that node-vk-bot-sdk demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.