Bot that adds posts to community wall
const bot = new VkPostBot("<access_token>");
bot.post({
"ownerId": "-1",
"friendsOnly": "1",
"fromGroup": "1",
"message": "test message",
"attachments": "https://example.com/"
});
Class represents bot that adds post on wall
Parameters
token
String access token
Add post on community wall
Parameters
params
{Object} - Parameters of postparams.ownerId
(Required) community ID - negative valueparams.friendsOnly
1 — post will be available to friends only, 0 — post will be available to all users (default)params.fromGroup
1 — post will be published by the community, 0 — post will be published by the user (default)params.message
(Required if attachments is not set.) Text of the post.params.attachments
(Required if message is not set.) List of objects attached to the post
Extends Error
Class represents custom error for Bad Request
Parameters
message
(string | null) error message (optional, defaultnull
)