Skip to content
Start free trial
Back to Academy

Academy

Connect VK to EnkaChat

Connect a VK community through the Callback API and answer VK customers from the same inbox as your website chat, Telegram, and WhatsApp.

Prerequisites

  • A workspace with the channels:manage permission and the omnichannel plan feature
  • Admin or member rights on the VK community you want to connect
  • Community messages and bot capabilities enabled on the community
  • A publicly reachable HTTPS origin with a CA-signed certificate for the Callback API server

01

Before you start

You need a workspace with the channels:manage permission and the omnichannel plan feature, plus admin or member rights on the VK community. The VK Callback API only delivers events to a publicly reachable HTTPS URL with a CA-signed certificate, so have a deployed origin or a public HTTPS tunnel ready.

warning

Localhost cannot receive VK events

The local http://api.enkachat.localhost origin cannot receive VK events. For local testing use a public HTTPS tunnel or a deployed origin, and point PUBLIC_API_URL at it.

02

Enable community messages and bot capabilities

In the VK community, open Management -> Communications and enable community messages, then enable The capabilities of bots in the same section. Community members can now message the community.

03

Create a community access token and find the community ID

Open Management -> Working with API and create a key for the community access token; VK ID two-factor authentication may be required the first time. The numeric community ID for group_id is shown in the same section.

Group token

vk1.a.<your-token>

warning

Keep the token secret

The group token is a credential. Keep it secret, and paste it into EnkaChat with no spaces.

04

Copy the Callback API confirmation code and optional secret key

Open Management -> Working with API -> Callback API. Copy the confirmation string for confirmation_code and, optionally, set a Secret key. When a secret key is set, VK echoes it as the top-level secret field on every event so EnkaChat can verify the payload in constant time.

Confirmation code

<confirmation-string>

05

Connect VK in EnkaChat

In the admin panel, open Integrations at http://app.enkachat.localhost and find the VK card. Click Connect and fill in the Group token, Group ID, Confirmation code, and an optional Secret key. EnkaChat shows the webhook URL and a one-time connection token; copy the token before closing the dialog.

Webhook URL

http://api.enkachat.localhost/webhooks/vk/<connection-token>

warning

The connection token is shown once

The connection token is displayed exactly once at creation, so copy it before closing the dialog.

06

Configure the Callback API in VK

Back in VK, open Management -> Working with API -> Callback API and add a server address: the webhook URL EnkaChat gave you. Set the API version to 5.199 and select the incoming messages event. VK sends a confirmation event, EnkaChat replies with your stored confirmation code, and VK marks the server confirmed.

API version

5.199

note

Events handled

EnkaChat uses the VK Community Callback API only (POST only), not Bots Long Poll. It replies to a confirmation event with the stored confirmation code, and to message_new events with the literal text ok (HTTP 200). Other event types are acknowledged with ok and ignored.

07

Verify the connection

Run the Health check; it calls VK's groups.getById with the group ID and token. The status badge moves from pending to active once the first verified event arrives. Send a test message to the community from a VK account; it lands as a channel session in the Chats inbox, where agents reply alongside website chat, Telegram, and WhatsApp.

08

Behavior and limits

Outbound replies carry the text body only; outbound attachments are dropped. Inbound photo, document, and audio attachments are downloaded up to the 10 MiB cap, while video attachments are skipped. Only direct community messages are handled, not group-chat or peer conversations.

  • Status lifecycle: pending, active, error, disabled
  • Disabling pauses inbound processing; deleting removes the connection
  • Duplicate deliveries are dropped via the channel_events unique triple; VK retries arrive with the X-Retry-Counter header

09

Add a VK contact button to the site widget

In the site widget's Channels settings (Settings -> Widget -> Channels) you can add a VK profile link button. Once the VK integration has an active connection, GET /widget/config marks VK as connected and the widget hides that contact link, because messages now land in the shared inbox.

FAQ

My group token is rejected

The Health check calls groups.getById with your group ID and token. A failure points to a wrong token, a wrong numeric group ID, or a token missing the community scope. Create a new key under Management -> Working with API and paste it with no spaces.

I rotated the confirmation code in VK

Update the connection in EnkaChat with the new code. The stored code has to match what VK sends in the confirmation event, or the server stays unconfirmed.

Why does VK skip my local server?

The Callback API delivers only to a publicly reachable HTTPS URL with a CA-signed certificate. Point PUBLIC_API_URL at a public HTTPS tunnel or a deployed origin for local testing.

What is the secret key for?

It is optional. When set, VK ships it as the top-level secret field on every event, and EnkaChat verifies it in constant time before processing.

Which VK events are supported?

EnkaChat handles confirmation and message_new. Every other event type is acknowledged with ok and ignored.

Do outbound attachments and images work on VK?

No. messages.send carries text only, and outbound attachments are dropped. Inbound photos, documents, and audio download up to the 10 MiB cap, and video is skipped.

Is there a VK one-click install?

No. You enter credentials by hand in the admin panel, and there is no VK OAuth flow.