vk
v0.10.0VK (VKontakte): read walls, users, communities and stats; publish, edit and comment on posts.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
vk_users_get Get user profiles
Look up VK users by numeric ID or short name (e.g. durov). Use this to resolve a name to an ID before calling other tools, or to check whether a profile is closed.
| Parameter | Type | Description |
|---|---|---|
fields | string | Profile fields to return |
user_ids | string | Comma-separated user IDs or screen names |
vk_users_search Search users
Find VK users by name, optionally narrowed by city, country, sex or age. Returns matches with a total count; page through them with offset.
| Parameter | Type | Description |
|---|---|---|
q * | string | Search query (name or keywords) |
age_from | number | Minimum age |
age_to | number | Maximum age |
city | number | City ID to filter by |
count | number | Number of results (max 1000) |
country | number | Country ID to filter by |
fields | string | Additional profile fields to return |
offset | number | Offset for pagination |
sex | number | Sex filter: 1 — female, 2 — male |
vk_wall_get Read a wall
Read posts from a user or community wall, newest first. Pass domain for a short address (durov) or owner_id for a numeric one — negative for a community, positive for a person. Each post carries its likes, reposts, comments and views.
| Parameter | Type | Description |
|---|---|---|
count | number | Number of posts (1-100) |
domain | string | Short address of user or community |
filter | string | Filter: all, owner, others, postponed, suggests |
offset | number | Offset for pagination |
owner_id | number | Wall owner ID (negative for community) |
vk_wall_post Publish a post
Publish a post on a wall. Under a community token, leave owner_id out and the post goes on that community's wall. Otherwise, to post in a community, set owner_id to the community ID with a minus sign (-123) and from_group true, or it appears as your personal post on the community wall. Attach media with the attachment string that vk_photos_upload_wall returns. Returns the new post_id.
| Parameter | Type | Description |
|---|---|---|
message * | string | Post text content |
attachments | string | Comma-separated attachments (e.g. photo123_456,link) |
community_id | string | Which of your communities acts, when VK_ACCESS_TOKEN holds tokens of several (ID or short name, e.g. 123 or apiclub; see vk_token_info). Leave out with a single token. |
from_group | boolean | Post on behalf of community |
guid | string | Unique identifier to prevent duplicate posts |
owner_id | number | Wall owner: a community as a negative number (-123), a person as a positive one. Defaults to the token's own community under a community token, to the token owner otherwise. |
publish_date | number | Unix timestamp for scheduled post (must be within 2 weeks) |
vk_wall_create_comment Comment on a post
Add a comment to a post. owner_id is negative for a community. Returns the new comment_id.
| Parameter | Type | Description |
|---|---|---|
message * | string | Comment text |
owner_id * | number | Wall owner: a community as a negative number (-123), a person as a positive one. Defaults to the token owner. |
post_id * | number | Post ID |
community_id | string | Which of your communities acts, when VK_ACCESS_TOKEN holds tokens of several (ID or short name, e.g. 123 or apiclub; see vk_token_info). Leave out with a single token. |
vk_wall_get_by_id Get specific posts
Fetch particular posts by their full IDs in {owner_id}_{post_id} form, e.g. -1_340393. Use it to re-read a post you already know about, such as one you just published.
| Parameter | Type | Description |
|---|---|---|
posts * | string | Comma-separated post IDs in format {owner_id}_{post_id} (e.g. -123_456) |
fields | string | Additional profile fields to return |
vk_wall_edit Edit a post
Replace the text or attachments of an existing post. owner_id is negative for a community. Editing overwrites the previous content, so pass the full new text rather than an addition.
| Parameter | Type | Description |
|---|---|---|
post_id * | number | Post ID to edit |
attachments | string | Comma-separated attachments |
message | string | New post text |
owner_id | number | Wall owner: a community as a negative number (-123), a person as a positive one. Defaults to the token owner. |
vk_wall_delete Delete a post
Delete a post from a wall. owner_id is negative for a community. This cannot be undone.
| Parameter | Type | Description |
|---|---|---|
post_id * | number | Post ID to delete |
owner_id | number | Wall owner: a community as a negative number (-123), a person as a positive one. Defaults to the token owner. |
vk_photos_upload_wall Upload a photo for a post
Upload a photo so it can be attached to a post. Takes a URL or a local file path, runs VK's three-step upload, and returns an attachment string like photo-1_2 to pass to vk_wall_post or vk_wall_edit. group_id is positive here, without the minus sign. Needs a full user token: VK refuses a community token here (error 27), and has no other way for one to attach a photo to a post.
| Parameter | Type | Description |
|---|---|---|
image * | string | Image URL (http/https) or absolute local file path |
caption | string | Photo caption |
group_id | string | Community ID or its short name (e.g. apiclub). Positive and without the minus sign — the minus belongs to owner_id on a wall, not here. |
vk_stories_post_photo Publish a photo story
Publish a photo story on VK (three-step upload: get upload server, upload the photo, save). Posts a personal story, or a community one when group_id is set.
| Parameter | Type | Description |
|---|---|---|
image * | string | Image URL (http/https) or absolute local file path |
add_to_news | boolean | Add the story to the news feed (default true) |
community_id | string | Which of your communities acts, when VK_ACCESS_TOKEN holds tokens of several (ID or short name, e.g. 123 or apiclub; see vk_token_info). Leave out with a single token. |
group_id | string | Community ID or its short name (e.g. apiclub) to post as. Positive and without the minus sign. Omit to post a personal story. |
link_text | string | Link button text |
link_url | string | Link URL for the button (requires link_text) |
vk_stories_post_video Publish a video story
Publish a video story on VK (three-step upload: get upload server, upload the video, save). Posts a personal story, or a community one when group_id is set.
| Parameter | Type | Description |
|---|---|---|
video * | string | Video URL (http/https) or absolute local file path |
add_to_news | boolean | Add the story to the news feed (default true) |
community_id | string | Which of your communities acts, when VK_ACCESS_TOKEN holds tokens of several (ID or short name, e.g. 123 or apiclub; see vk_token_info). Leave out with a single token. |
group_id | string | Community ID or its short name (e.g. apiclub) to post as. Positive and without the minus sign. Omit to post a personal story. |
link_text | string | Link button text |
link_url | string | Link URL for the button (requires link_text) |
vk_messages_get_conversations List community conversations
List the conversations in your community's inbox, newest first, with the last message of each and the names of the people in them. Use filter "unread" to see what is waiting for a reply. Needs a community token with the messages right.
| Parameter | Type | Description |
|---|---|---|
community_id | string | Which of your communities acts, when VK_ACCESS_TOKEN holds tokens of several (ID or short name, e.g. 123 or apiclub; see vk_token_info). Leave out with a single token. |
count | number | How many to return (default 20, max 200) |
filter | string | Which conversations: all (default), unread, important, or unanswered |
offset | number | Offset for pagination |
vk_messages_get_history Read a conversation
Read the messages of one conversation in your community's inbox, newest first. peer_id is the person's user ID, as vk_messages_get_conversations shows it. Needs a community token with the messages right.
| Parameter | Type | Description |
|---|---|---|
peer_id * | number | User ID of the person the community is talking to |
community_id | string | Which of your communities acts, when VK_ACCESS_TOKEN holds tokens of several (ID or short name, e.g. 123 or apiclub; see vk_token_info). Leave out with a single token. |
count | number | How many messages to return (default 20, max 200) |
offset | number | Offset for pagination |
vk_messages_send Reply as the community
Send a message from your community to a person. VK only delivers to people who have written to the community or allowed it to message them. This reaches a real person: show the user the text before sending. Returns the new message_id.
| Parameter | Type | Description |
|---|---|---|
message * | string | Message text |
peer_id * | number | User ID of the recipient |
attachment | string | Optional media, e.g. photo-1_2 or doc-1_2, comma-separated |
community_id | string | Which of your communities acts, when VK_ACCESS_TOKEN holds tokens of several (ID or short name, e.g. 123 or apiclub; see vk_token_info). Leave out with a single token. |
reply_to | number | Optional ID of the message this answers, to quote it |
vk_messages_mark_as_read Mark a conversation as read
Mark every message in one conversation of your community's inbox as read, e.g. after answering it.
| Parameter | Type | Description |
|---|---|---|
peer_id * | number | User ID of the person the community is talking to |
community_id | string | Which of your communities acts, when VK_ACCESS_TOKEN holds tokens of several (ID or short name, e.g. 123 or apiclub; see vk_token_info). Leave out with a single token. |
vk_events_listen Start watching the community
Start receiving what happens in your community as it happens: new comments with their text and ID (so you can answer them with vk_wall_create_comment), likes, new posts and reposts, people joining and leaving, messages. Turns on the community's Long Poll and the event types if they are off. VK keeps no history: only events from now on are seen, while this server runs. Read them with vk_events_get.
| Parameter | Type | Description |
|---|---|---|
community_id | string | Which of your communities acts, when VK_ACCESS_TOKEN holds tokens of several (ID or short name, e.g. 123 or apiclub; see vk_token_info). Leave out with a single token. |
types | array | Event types to turn on. Default: wall_post_new, wall_repost, wall_reply_new, wall_reply_edit, wall_reply_delete, wall_reply_restore, like_add, like_remove, group_join, group_leave, message_new, messag… |
vk_events_get Read community events
Read the community events received since vk_events_listen, oldest first. Pass the returned cursor as after next time to get only new ones. With wait (up to 25 seconds) it holds until something arrives — call it in a loop to follow the community, e.g. to answer each new comment.
| Parameter | Type | Description |
|---|---|---|
after | number | Cursor from the previous call; events after it are returned (default: all received) |
community_id | string | Which of your communities acts, when VK_ACCESS_TOKEN holds tokens of several (ID or short name, e.g. 123 or apiclub; see vk_token_info). Leave out with a single token. |
limit | number | Most events to return (default 50, max 200) |
types | array | Only these event types, e.g. ["wall_reply_new"] |
wait | number | Seconds to wait for an event when there is none yet (0–25, default 0) |
vk_groups_search Search communities
Find communities by keyword, optionally narrowed by type, country, city or sort order. Returns matches with a total count.
| Parameter | Type | Description |
|---|---|---|
q * | string | Search query |
city_id | number | City ID to filter by |
count | number | Number of results (max 1000) |
country_id | number | Country ID to filter by |
fields | string | Additional community fields to return |
future | number | Filter future events: 1 — only future events |
offset | number | Offset for pagination |
sort | number | Sort order: 0 — default, 1 — by speed, 6 — by likes |
type | string | Community type: group, page or event |
vk_groups_get_members List community members
List the members of a community. Returns bare user IDs unless you ask for fields, in which case it returns profiles. Many communities hide their member list, which comes back as an access error rather than an empty list.
| Parameter | Type | Description |
|---|---|---|
group_id * | string | Community ID or its short name (e.g. apiclub). Positive and without the minus sign — the minus belongs to owner_id on a wall, not here. |
count | number | Number of members to return (max 1000) |
fields | string | Additional profile fields to return (e.g. photo_200,online,sex,city) |
filter | string | Filter: managers, editors, mods, advertisers, friends, unsure |
offset | number | Offset for pagination |
sort | string | Sort order: id_asc, id_desc, time_asc, time_desc |
vk_groups_join Join a community
Join a community as the token owner, or send a join request if it is closed. group_id is positive here, without the minus sign.
| Parameter | Type | Description |
|---|---|---|
group_id * | string | Community ID or its short name (e.g. apiclub). Positive and without the minus sign — the minus belongs to owner_id on a wall, not here. |
not_sure | number | For events only: 1 — "maybe attending", 0 — confirmed |
vk_groups_get List your communities
List the communities the token owner belongs to. Needs a user token — a community or service token cannot answer this.
| Parameter | Type | Description |
|---|---|---|
count | number | Number of communities |
fields | string | Community fields |
filter | string | Filter by type |
user_id | number | User ID. Defaults to the token owner. |
vk_groups_get_by_id Get community info
Look up communities by numeric ID or short name (e.g. apiclub). Use it to resolve a name to an ID, or to read the description, member count and type before deciding what to do with it.
| Parameter | Type | Description |
|---|---|---|
fields | string | Community fields |
group_ids | string | Comma-separated community IDs or short names (e.g. apiclub,vk). Positive and without the minus sign. |
vk_friends_get List friends
List a user's friends. Returns bare IDs unless you ask for fields. Needs a user token, and only works for profiles that expose their friend list.
| Parameter | Type | Description |
|---|---|---|
count | number | Number of friends |
fields | string | Profile fields |
order | string | |
user_id | number | User ID. Defaults to the token owner. |
vk_newsfeed_get Read your newsfeed
Read the token owner's own newsfeed. Needs a user token — this is the feed of the account the token belongs to, not a public one.
| Parameter | Type | Description |
|---|---|---|
count | number | Number of items |
filters | string | Filter by type: post, photo, video |
start_from | string | Pagination cursor |
vk_stats_get Community statistics
Read a community's statistics by period: reach, visitors and activity. The token owner must be an administrator of that community, otherwise VK denies access.
| Parameter | Type | Description |
|---|---|---|
group_id * | string | Community ID or its short name (e.g. apiclub). Positive and without the minus sign — the minus belongs to owner_id on a wall, not here. |
interval | string | |
intervals_count | number | Number of intervals |
vk_likes_get See who reacted
List the users who liked or reacted to an object — a post, comment, photo or video — with counts per reaction. owner_id is negative for a community; item_id is the post or object ID.
| Parameter | Type | Description |
|---|---|---|
item_id * | number | Object ID |
type * | string | Object type |
count | number | Number of users to return (max 1000) |
offset | number | Offset for pagination |
owner_id | number | Owner ID of the object (negative for community) |
reaction_id | number | Filter by reaction: 0 — like ❤️, 1 — laugh 😂, 2 — wow 😮, 3 — admiration 🔥, 4 — angry 😡, 5 — sad 😢 |
vk_photos_get Get photos
List photos from an album. album_id accepts wall, profile or saved as well as a numeric album ID. owner_id is negative for a community.
| Parameter | Type | Description |
|---|---|---|
album_id | string | Album ID or: wall, profile, saved |
count | number | Number of photos |
owner_id | number | Album owner: negative for a community, positive for a person. |
vk_token_info What the VK token can do
Say which VK token the server holds — a community token, a user token, a VK ID sign-in token or an app service key — which community it acts as and with which rights, which tools work with it, and for each tool that does not, what would make it work. Call it when unsure what you can do in VK, or before telling the user something cannot be done.