6.1 KiB
VK (VKontakte)
The VK channel uses Bots Long Poll API for bot-based communication with VK social network. It supports text messages, media attachments (photos, videos, audio, documents, stickers), and group chat interactions.
Configuration
{
"channel_list": {
"vk": {
"enabled": true,
"type": "vk",
"token": "NOT_HERE",
"group_id": 123456789,
"allow_from": ["123456789"],
"group_trigger": {
"mention_only": false,
"prefixes": ["/bot", "!bot"]
}
}
}
}
| Field | Type | Required | Description |
|---|---|---|---|
| enabled | bool | Yes | Whether to enable the VK channel |
| token | string | Yes | Set to NOT_HERE - token is stored securely (see Token Storage) |
| group_id | int | Yes | VK Community ID (Group ID) |
| allow_from | array | No | Allowlist of user IDs; empty means all users are allowed |
| group_trigger | object | No | Configuration for group chat triggers |
Token Storage
For security reasons, the VK access token should not be stored directly in the configuration file. Instead:
- Set
tokento"NOT_HERE"in the configuration - Store the actual token using one of these methods:
- Environment variable: Set
PICOCLAW_CHANNELS_VK_TOKENenvironment variable - Secure storage: Use PicoClaw's secure token storage mechanism
- Environment variable: Set
Example using environment variable:
export PICOCLAW_CHANNELS_VK_TOKEN="vk1.a.abc123..."
Group Trigger Configuration
| Field | Type | Description |
|---|---|---|
| mention_only | bool | Only respond when bot is mentioned in group chats |
| prefixes | []string | List of prefixes that trigger bot response in group chats |
Setup
1. Create a VK Community
- Go to VK and log in
- Create a new community or use an existing one
- Note your Community ID (found in the community URL, e.g.,
public123456789)
2. Enable Messages
- Go to your community page
- Click "Manage" → "Messages" → "Community Messages"
- Enable community messages
3. Create Access Token
- Go to "Manage" → "API usage" → "Access tokens"
- Click "Create token"
- Select the following permissions:
messages- Access to messagesphotos- Access to photos (optional)docs- Access to documents (optional)
- Copy the generated access token
- Store the token securely (see Token Storage section below)
4. Configure PicoClaw
- Add the token to your PicoClaw configuration
- Set the
group_idto your community ID (numeric value) - (Optional) Configure
allow_fromto restrict which user IDs can interact
Features
Supported Message Types
- Text messages: Full support for text messages
- Photos: Photos are displayed as
[photo]placeholder - Videos: Videos are displayed as
[video]placeholder - Audio: Audio files are displayed as
[audio]placeholder - Voice messages: Voice messages are displayed as
[voice]placeholder and support transcription - Documents: Documents are displayed as
[document: filename] - Stickers: Stickers are displayed as
[sticker]placeholder
Voice Support
The VK channel supports both voice message reception and text-to-speech capabilities:
- ASR (Automatic Speech Recognition): Voice messages can be transcribed to text using configured voice models
- TTS (Text-to-Speech): Text responses can be converted to voice messages
To enable voice transcription, configure a voice model in your providers setup. See Voice Transcription for details.
Group Chat Support
The VK channel supports group chats with configurable triggers:
- Mention-only mode: Bot only responds when mentioned
- Prefix mode: Bot responds to messages starting with specified prefixes
- Permissive mode: Bot responds to all messages (default)
Message Length
VK has a maximum message length of 4000 characters. PicoClaw automatically splits longer messages into multiple parts.
Example Configuration
Basic Configuration
{
"channel_list": {
"vk": {
"enabled": true,
"type": "vk",
"token": "NOT_HERE",
"group_id": 123456789
}
}
}
With User Whitelist
{
"channel_list": {
"vk": {
"enabled": true,
"type": "vk",
"token": "NOT_HERE",
"group_id": 123456789,
"allow_from": ["123456789", "987654321"]
}
}
}
With Group Chat Triggers
{
"channel_list": {
"vk": {
"enabled": true,
"type": "vk",
"token": "NOT_HERE",
"group_id": 123456789,
"group_trigger": {
"prefixes": ["/bot", "!bot"]
}
}
}
}
Troubleshooting
Bot Not Responding
- Check that the access token is valid
- Verify that the
group_idis correct - Ensure the user ID is in
allow_fromif configured - Check PicoClaw logs for error messages
Permission Errors
Make sure the access token has the necessary permissions:
messages- Required for sending and receiving messagesphotos- Optional, for handling photo attachmentsdocs- Optional, for handling document attachments
Group Chat Issues
If the bot doesn't respond in group chats:
- Check
group_triggerconfiguration - Try using a prefix to trigger the bot
- Check if the bot has permission to read group messages
API Reference
The VK channel uses the VK SDK for Go library, which supports VK API version 5.199.
For more information about VK API, see: