Imagine your business losing up to 30% of leads daily because managers can't respond in time on messengers. A VK chat bot solves this—processing orders, answering questions, and forwarding complex requests to operators. For example, for a coffee chain we implemented a bot that takes orders, integrates with CRM, and reduced processing time by 60%. This helped increase conversion by 25%. Over the years, we have developed more than 50 such bots for e-commerce, services, and media, each handling up to 10,000 messages per minute. Savings on operational costs amount to tens of thousands of rubles monthly.
We use a modern stack: Python FastAPI, vk_api, JavaScript for Mini Apps. We'll evaluate your project in one day—just contact us.
VK Chat Bot Development: Features and Tech Stack
How to Choose Between Callback API and Long Poll?
Callback API—VK sends a POST to your HTTPS server for each event. It's a webhook analog, suitable for production.
Long Poll—your server makes a GET request that "hangs" until a new event appears. Works without HTTPS, convenient for development.
Comparison:
| Parameter | Callback API | Long Poll |
|---|---|---|
| Protocol | HTTPS (POST) | HTTP (GET) |
| Reliability | High, with retries | Medium, connection-dependent |
| Production | Recommended | Test only |
| Setup | Requires HTTPS server | Any server |
For production bots, we always use Callback API. It ensures guaranteed delivery and automatic retries on failures.
Callback API is configured in the "Management" → "Working with API" → "Callback API" section of the VK group. When adding, VK sends a confirmation event—you must return the string from settings:
from fastapi import FastAPI, Request
app = FastAPI()
CONFIRMATION_TOKEN = "abc123xyz" # From group settings
SECRET_KEY = "your_secret" # For signature verification
@app.post("/vk/webhook")
asy nc def vk_webhook(request: Request):
data = await request.json()
# Signature check
if data.get("secret") != SECRET_KEY:
return "forbidden"
if data["type"] == "confirmation":
return CONFIRMATION_TOKEN
if data["type"] == "message_new":
message = data["object"]["message"]
await handle_message(message)
return "ok" # VK requires exactly the string "ok"
If you return anything other than "ok", VK will resend the event up to 3 times, then mark delivery as failed.
According to VK API documentation, Callback API guarantees delivery with retries.
How to Send Messages with a Keyboard?
import vk_api
from vk_api.bot_longpoll import VkBotLongPoll, VkBotEventType
# Through vk_api library
vk_session = vk_api.VkApi(token=GROUP_TOKEN)
vk = vk_session.get_api()
def send_message(peer_id: int, text: str, keyboard=None):
params = {
"peer_id": peer_id,
"message": text,
"random_id": 0 # 0 = auto random_id for duplicate protection
}
if keyboard:
params["keyboard"] = json.dumps(keyboard)
vk.messages.send(**params)
More about random_id
VK uses random_id for deduplication. If you pass 0, the system generates it automatically. With the same random_id, duplicate sends are prevented.random_id is important: VK deduplicates messages by (peer_id, random_id). With random_id=0 it's automatic. With a fixed value, a repeat call won't create a new message—protection against double sending.
Keyboards come in two types: regular (replaces system keyboard) and inline (attached to a message). Example inline keyboard:
keyboard = {
"inline": True,
"buttons": [
[
{
"action": {
"type": "text",
"label": "Catalog",
"payload": json.dumps({"command": "catalog"})
},
"color": "primary"
}
]
]
}
Button colors: primary, secondary, positive, negative. Maximum 4 buttons per row, 10 rows.
What are VK Mini Apps and How to Integrate Them?
VK Mini Apps are web applications inside VK, similar to Telegram Mini Apps. SDK: @vkontakte/vk-bridge.
import bridge from '@vkontakte/vk-bridge';
bridge.subscribe((e) => {
if (e.detail.type === 'VKWebAppUpdateConfig') {
// Theme (light/dark), color scheme
const scheme = e.detail.data.scheme;
document.body.setAttribute('scheme', scheme);
}
});
// Get user data
const userInfo = await bridge.send('VKWebAppGetUserInfo');
// { id, first_name, last_name, photo_200, ... }
vk-bridge allows: get user data, open payment dialog (VKWebAppOpenPayForm), request geolocation, copy to clipboard, open QR scanner.
Mini App authorization: launch_params in URL contain signed data (sign field). Verification on server via HMAC-SHA256 with API Secret from app settings—mandatory.
Common Development Errors
- Incorrect request verification. If you don't check
secretor don't return"ok", VK will repeat requests and eventually disable the callback. - Incorrect
random_id. Using a fixed value can cause message loss. Best to always pass0for automatic generation. - Ignoring keyboard limits. Max 4 buttons per row and 10 rows. Exceeding returns an error.
- Lack of API error handling. When sending a message, VK may return an error, e.g., if the user has disabled messages from the group.
On every project, we conduct code audits and test these cases. Want to avoid these errors? Contact us—we'll help.
Work Process and Timelines
| Stage | Duration | Result |
|---|---|---|
| Requirements analysis | 1–2 days | Technical specification |
| Architecture design | 1–2 days | Bot scheme, stack selection |
| Bot development | 1–3 weeks | Working prototype |
| VK Mini App integration (if needed) | +2–4 weeks | Full application |
| Testing and debugging | 5–7 days | Bug fixes |
| Deployment and monitoring | 1–2 days | Bot in production |
Typical timeline: bot with keyboard—1–2 weeks, with VK Mini App—4–8 weeks.
What's Included in Development?
- VK group setup and Callback API configuration
- Message handling logic (commands, scenarios)
- Keyboards and carousels implementation
- Integration with external services (CRM, databases)
- VK Mini App development (if required)
- Operation documentation
- Team training
- 1 month free technical support
Why Choose Us?
- Years of experience developing bots for VK and other platforms
- Numerous successful projects for small and medium businesses
- Certified VK API developers
- Guarantee of stable operation and adherence to deadlines
Development cost is discussed individually, but on average it pays off within six months through automation. Request a consultation—we'll evaluate your project in one day.







