Source Code
VK Community Management
This skill allows you to manage a VK community using the VK API.
Requirements
- VK Access Token. Важно: Используйте User Token для полных прав (удаление постов, простая загрузка фото). См. references/api.md для деталей.
- Node.js environment.
Core Workflows
1. Posting to the Wall
To post to a community wall:
- Если есть медиафайлы, загрузите их:
node scripts/vk_cli.js upload-photo $TOKEN $GROUP_ID "./image.jpg"
- Используйте
postс полученным ID вложения:node scripts/vk_cli.js post $TOKEN -$GROUP_ID "Текст поста" $ATTACH_ID
2. Handling Messages
To respond to user messages:
- Fetch history with
get-messages. - Send a reply with
message.
3. Real-time Monitoring (Long Poll)
To receive and process messages instantly:
- Ensure Long Poll API is enabled in your group settings (Manage → API Interaction → Long Poll API).
- Use the
pollcommand:node scripts/vk_cli.js poll $TOKEN $GROUP_ID 1(where1means auto-mark as read).
Note: This skill works best with a User Token that has messages,wall,groups,offline permissions. Use VK Host to get a permanent token.
Advanced Features
For details on setting up Long Poll and specialized API methods, refer to references/api.md.