Connect a web app
Send events from your app to your bot. Push bot data to your own backend. Give this page to your app builder.
- 1. Web app → bot: your server posts JSON to a hook URL.
- 2. Bot → web app: your bot calls
fetch()to your backend. - 3. Web app → bot data: your server reads bot data and status with an API key, and with a key made with writes on it can set, add to or clear one member's row. A web app cannot change bot settings.
Prompt for your app builder
Paste this into Lovable or any agent.
Read https://www.vibebot.gg/docs/integrations/web-apps and connect my dashboard to my VibeBot bot.
- To send commands to the bot, use path 1 (inbound hook). Call it from a server function, never from the browser. The hook URL and secret are in my env vars VIBEBOT_HOOK_URL and VIBEBOT_HOOK_SECRET.
- If my bot redeems codes that the dashboard makes (premium codes, gift codes, keys), send each new code to the bot over path 1 when the dashboard makes it. A code that stays only in my database never works in the bot.
- Or, if my key has Allow writes on, save each new code with path 3b: PUT /bots/{botId}/data/<type>/<code> with the type and guildId my redeem command reads, and header Idempotency-Key: <code>. A code is 1 to 64 letters, digits, _ or -, and does not start with _.
- To receive data from the bot, use path 2 (mirror pattern). Create an endpoint that accepts POST JSON with header Authorization: Bearer <key> and writes the rows to my database. The dashboard reads my database only.
- To read bot data or bot status, use path 3 (owner API). Call https://www.vibebot.gg/api/v1 from a server function with header Authorization: Bearer <key>. The key is in my env var VIBEBOT_API_KEY.
- To change one member's data (a shop, rewards), use path 3b (owner API writes) with a key made with Allow writes on. Send an Idempotency-Key header on every increment.
Do not try to change bot settings over an API. That does not exist.1. Web app → bot (inbound hooks)
Set up
- Open your bot. Open Integrations (under Configure on desktop). Click New hook.
- Copy the URL and the secret (
whsec_...). The secret shows once. If you lose it, click New secret on the hook. The URL stays the same. - Store both in your app's server env vars. Never put the secret in browser code.
Endpoint
- Method:
POST https://www.vibebot.gg/api/hooks/{botId}/{slug} - Header:
x-vibebot-secret: whsec_... - Body: a JSON object or array, max 64 KB.
- Reply:
202 {"ok":true}. No data comes back.
Responses
| Status | Meaning |
|---|---|
| 200 | A Ko-fi form post: queued, or a repeat of one already queued. |
| 202 | Queued. Not yet handled. |
| 400 | Body is not valid JSON. |
| 401 | Wrong or missing secret. |
| 404 | Unknown hook, paused hook, or wrong botId. |
| 413 | Body over 64 KB. |
| 429 | Rate limited: 120/min per bot, 300/min per IP. Retry after a short wait. |
| 500 | Server error. Retry after a short wait. |
Limits
- Delivery is not instant. The bot picks up events on its next heartbeat.
- The queue keeps the 50 newest events per bot. Events expire after 1 hour.
- Max 10 hooks per bot.
- Hooks need your own deployed bot. VibeBot Basic (the shared bot) does not receive them.
In the bot
A behavior with the webhook trigger runs. Each behavior belongs to one hook, so give the Bot Builder the hook URL:
Add a webhook trigger for my hook <paste the hook URL>: when my dashboard sends {type:'announce', channelId, text}, post text in that channel.In custom code, eventData is the posted JSON body. There is no interaction, message or member. Use client.channels to find a channel by ID in any server.
Codes your app makes.Your bot finds only the data it saved itself. A code that your app makes (a premium code, a gift code, a key) stays in your app's database, so a redeem command in the bot never finds it. Send each new code to the bot when your app makes it:
- Your server posts the new codes to the hook, with the secret header, as in the server code above. Never from the browser.
- A webhook behavior in the bot saves each code with the same key, data type and server that the redeem command reads.
Add a webhook trigger for my hook <paste the hook URL>: when my dashboard sends {type:'new_codes', codes:[{code, days}]}, save each code so /redeem finds it. Use the same key, data type and server that /redeem reads.- The bot must be online. A code waits at most 1 hour for the bot. After that, send it again.
- A new code works in the bot about 1 minute after your server posts it. The bot takes 10 events a minute, so send many codes as one list in one post.
Or write each code with the owner API. With an API key made with Allow writes on (section 3b), your server saves each new code straight into the bot data. Use the same data type and server that the redeem command reads. No webhook behavior is needed.
- The code works at once, also while the bot is offline. There is no 50-event queue and no 1-hour limit. One call saves one code, at most 60 a minute per key. For a big batch, use the hook.
- A code is 1 to 64 letters, digits, _ or -, and does not start with _. Any other code is refused. Send the code as the
Idempotency-Key. Then a retry with the same API key within 90 days never brings back a used code. Keep the API key on your server: it can change all your bot's data.
2. Bot → web app (fetch from custom code)
Set up
- Create an endpoint in your backend that accepts POST JSON.
- Open your bot. Open Integrations (under Configure on desktop), then Environment variables. Add
DASHBOARD_URLandDASHBOARD_KEY. Values are never shown back. - Press Put live. New env vars reach the bot only then.
- Ask the Bot Builder to post to it. Read keys with
env('NAME'). Do not hardcode them.
When someone levels up, POST {event:'level_up', userId, level} to my endpoint from env var DASHBOARD_URL with header Authorization: Bearer <value of env var DASHBOARD_KEY>.Rules
- Use a public URL. The Bot Builder refuses code with a private IP or an AI-provider URL in it.
- Use the global
fetch.require('axios')andrequire('http')do not work. env('NAME')returnsundefinedfor a name you did not add. It never throws.
3. Web app → bot data (owner API)
Set up
- Open your bot. Open Integrations (under Configure on desktop), then API keys. Click New key, give it a name, then click Create key. API keys need Pro.
- Copy the key (
vbk_...). The key shows once. Click Done when you have it. If you lose it, click Replace key. The old key stops working within a minute. - Store the key in your server env var
VIBEBOT_API_KEY.
A key reads one bot. It has the scopes data:read and status:read, reads every server of the bot, and does not expire. A key made with Allow writes on also has data:write (section 3b). It stops working when you revoke it, when your Pro ends, or when you lose access to the bot.
Endpoints
Use https://www.vibebot.gg. https://vibebot.gg answers with a 308 redirect, and some clients drop the Authorization header on a redirect. botId is the VibeBot bot UUID that /api/v1/me returns. It is not the Discord application ID. Send the key in every request: Authorization: Bearer vbk_.... Every reply from these routes is JSON and is never cached.
GET /api/v1/me (scope any).Check that a key works. Reads no bot data. In v1, guildId and expiresAt are always null.
Reply: { botId, scopes, guildId, keyPrefix, expiresAt }
GET /api/v1/bots/{botId} (scope status:read).The bot status as the bot last reported it: online, offline, deploying, error or stopped. Anything except online means the bot is not up. guildId is the one server connected in the dashboard, or null.
Reply: { id, name, status, lastHeartbeat, guildId, guildName, configVersion, createdAt }
GET /api/v1/bots/{botId}/data (scope data:read).The data types of one server, by name in byte order, with the rows of each. Query: guildId (required). At most 500 types; truncated is true when the server has more.
Reply: { guildId, types: [{ type, rows }], truncated }
GET /api/v1/bots/{botId}/data/{type} (scope data:read).The top rows of one data type in one server, like a leaderboard. Query: guildId (required), sortField, sortOrder (asc or desc, default desc), limit (default 50), cursor. limit must be a whole number of 1 or more; a value over 100 returns 100 rows. For the next page, send nextCursor as cursor with the same guildId, sortField and sortOrder. nextCursor is null on the last page. On 400 Invalid cursor, start again from the first page with no cursor.
Reply: { guildId, items: [{ discordUserId, data }], nextCursor }
GET /api/v1/bots/{botId}/data/{type}/{discordUserId} (scope data:read).One member's row of one data type in one server. Query: guildId (required). A member with no row gives exists: false and data: null, with no dates.
Reply: { discordUserId, guildId, exists, data, createdAt, updatedAt }
Data types, servers and rows
- Type: the
typeargument in your bot's botData calls, for examplecoins. The dashboard has no data viewer. To get the exact names, callGET /api/v1/bots/{botId}/data(above). - Unknown type: a type the bot never wrote gives 200 with
"items":[]and"nextCursor":null. The row endpoint gives"exists":false. So an empty list can mean a misspelled type. A 404 comes only for a name that is not 1 to 64 letters, digits,_or-, starts with_, or issharding_warning. - guildId: required on every data call. Use a server ID (5 to 25 digits) or
global. Rows the bot wrote with no server are underglobal. To copy a server ID, turn on Developer Mode in Discord, right-click the server, then click Copy Server ID. - data: any JSON the bot saved, for example
1250or{"coins":1250,"level":7}. Top-level keys that start with_are removed. - Order: rows that are a bare number rank by their value. Object rows rank last unless you pass
sortFieldwith the name of a numeric field. Rows with the same rank sort bydiscordUserIdin text order. - Paging: each page reads live data. If scores change while you page, a row can repeat or be skipped. The cursor stays valid.
- Members: the API returns
discordUserIdonly. It returns no names.
Responses
| Status | Meaning |
|---|---|
| 200 | OK. JSON body as listed above. |
| 400 | Bad query. The body is {"error":"...","message":"..."}. The list is below. |
| 401 | {"error":"Unauthorized"}. No key, a wrong key or a revoked key. |
| 403 | {"error":"Forbidden"}. The account that made the key has no Pro, or the account is frozen. |
| 404 | {"error":"Not found"}. Any other UUID as botId (another bot's, or no bot), a bot you cannot reach, an internal data type name, a row key that is not 1 to 64 letters, digits, _ or - or that starts with _, or the API is switched off. A botId that is not a UUID gets {"error":"Bot not found"}. |
| 429 | A body like {"error":"Rate limit exceeded","retryAfter":12,"resetAt":"2026-10-12T15:05:00.000Z"}. Wait for the seconds in Retry-After. |
| 500 | Server error. Retry after a short wait. |
Every 400 the API sends. Check error, not message.
| error | message |
|---|---|
Missing guildId (also sent for a malformed guildId) | Add ?guildId=<Discord server id>, or ?guildId=global for DM and bot-wide data. |
Invalid sortField | Use 1 to 64 letters, digits or underscores. |
Invalid sortOrder | Use asc or desc. |
Invalid limit | Use a whole number from 1 to 100. |
Invalid cursor | Pass nextCursor from the previous page unchanged, with the same guildId, sortField and sortOrder. |
Query too long | Keep the query string to at most 2048 characters. |
Invalid JSON | Send a JSON object in the body. |
Missing body | Send a JSON object in the body. |
Invalid body | The body must be a JSON object. |
Invalid guildId | guildId must be a string: a Discord server id, or global. |
guildId mismatch | The guildId in the body and in the query differ. Send one of them. |
Invalid Idempotency-Key | Use 1 to 128 letters, digits, _ . : or -. |
Missing Idempotency-Key (increment only) | Send an Idempotency-Key header, one per order or action, so a retry with the same API key within 90 days cannot add twice. |
Missing data | Send data: any JSON value. To clear the row, use DELETE. |
Invalid number | Every number in data must be finite. |
Invalid string | Strings in data are well-formed text (no lone surrogate) and hold no NUL. |
Data too deep | Nest data at most 8 levels deep. |
Too many keys | Keep each object in data to at most 500 keys. |
Invalid key | Keys in data are at most 64 characters of well-formed text (no lone surrogate) and hold no NUL. |
Reserved key | A top-level key cannot start with _, and __proto__, constructor and prototype are refused at any depth. |
Invalid mode | Use merge or replace. |
Invalid ifUpdatedAt | Send the updatedAt of the row as you read it, an ISO 8601 time. |
Invalid by | by must be a JSON number other than 0 (not a string). |
by too large | Keep |by| to at most 1000000 per call. |
by too precise | by may have at most 8 fractional digits. |
Invalid field | field is a top-level key: 1 to 64 letters, digits or underscores, not starting with _, not constructor or prototype. |
Invalid allowNegative | allowNegative is true or false. |
Invalid min | min is a finite JSON number with |min| at most 1000000000000000. |
Invalid max | max is a finite JSON number with |max| at most 1000000000000000. |
min above max | min must not be above max. |
Limits
A 200 reply has X-RateLimit-Remaining and X-RateLimit-Reset for the per-key limit. X-RateLimit-Reset is in milliseconds since the Unix epoch. A 429 reply has them for the limit that refused the call, and Retry-After in seconds.
| Limit | Value |
|---|---|
| Per key | 60 requests/min |
| Per bot (all its keys) | 120 requests/min |
| Per account | 300 requests/min (60/min on a Pro trial) |
| Per IP | 120 requests/min |
| Wrong keys per IP (401, and 404 for a botId the key cannot read, count) | 20 per 10 min, then 429 until the 10 minutes end |
| Wrong tries of one key (401, and 404 for a botId the key cannot read) | 5 per hour, then 429 until the hour ends |
| Keys per bot | Max 5 |
| New keys per account | 10 per hour |
| Query string | At most 2048 characters |
| Writes per key | 60 writes/min |
| Writes per bot (all its keys) | 120 writes/min |
| Writes to one member (bot, server, member) | 10 writes/min |
| Write body | At most 65536 bytes |
| Row after a write | At most 1048576 characters of JSON |
| by per increment | At most 1000000, with at most 8 decimals |
| Result of an increment | At most 1000000000000000 in size |
| Idempotency-Key | 1 to 128 letters, digits, _ . : or -; remembered 90 days |
Serverless hosts share IP addresses, so other callers can use up the per-IP limit. Cache replies on your side. A key that worked in the last 10 minutes skips the wrong-keys-per-IP lockout.
The OpenAPI file is at /openapi/owner-api-v1.json.
3b. Web app → bot data: writes (set, add, clear)
Writes let your website change what the bot stores about a member. Give coins from your site after a purchase. Sell items in a shop, with a balance check, so nobody spends coins they do not have. Set VIP on a member from a form. Each write changes one member's row of one data type in one server.
Set up: make a new key with Allow writes on. In the New key dialog, tick Allow writes. The key row then says Read + write, and the section lists what the key did under Recent writes. Existing keys cannot write; make a new key with writes on. A write key without Pro, or on a restricted account, gets 403.
Idempotency-Key header (required on increment): one value per order or action. A retry with the same API key and key within 90 days gets the same reply and applies once.A shop
This example takes 250 coins for one order. It shows the balance check, and what a retry with the same key gets.
Endpoints
A write from the API behaves exactly like a write from a second copy of your bot: the bot's own botData calls see it on their next read, and a bot botData.update running at the same time retries on its own. Prefer increment and merge; replace only what you own. The bot's data rules apply: a top-level key that starts with _is refused, and a merged row stays under the bot's own 1 MB write cap.
PUT /api/v1/bots/{botId}/data/{type}/{discordUserId} (scope data:write).Set one member's row. Body: { guildId, data, mode, ifUpdatedAt }. mode merge (the default): an object merges into an object by key, and new keys win; any other shape on either side replaces. mode replace: the row becomes data. ifUpdatedAt is the updatedAt you read; if the row changed since, 409 CAS_FAILED. created is true when the row is new.
Reply: { discordUserId, guildId, created, data, updatedAt }
POST /api/v1/bots/{botId}/data/{type}/{discordUserId}/increment (scope data:write).Add by to one member's number in one atomic step. Body: { guildId, by, field, allowNegative, min, max }. Without field the row is the number; with field, data[field] is (a top-level key). A missing row starts at 0. Header Idempotency-Key is required. A result below 0 answers 409 INSUFFICIENT unless allowNegative is true: a deposit onto a negative balance is refused too. min and max clamp the result, on a new row as well; a max below 0 is also INSUFFICIENT unless allowNegative is true.
Reply: { discordUserId, guildId, field, before, after, created, updatedAt }
DELETE /api/v1/bots/{botId}/data/{type}/{discordUserId} (scope data:write).Clear one member's row, like the bot's botData.set(..., null). Query: guildId (required). deleted is false when there was no row.
Reply: { discordUserId, guildId, deleted }
Write responses
| Status | Meaning |
|---|---|
| 200 | OK. JSON body as listed above. A replay of an Idempotency-Key has the header X-Idempotency-Replayed: true. |
| 409 | A refused write: {"error":"...","code":"..."} with one of the codes below. Also {"error":"Build mode"} while a chat with the AI is open on the bot, and {"error":"In progress"} while the same Idempotency-Key is being written: retry in a second. |
| 413 | {"error":"Payload too large"} for a body over 65536 bytes, or {"error":"Data too large"} when the row after the write would pass 1048576 characters of JSON. Nothing changed. |
| 422 | {"error":"Idempotency key reused"}. The same Idempotency-Key with a different request. Use a new key. |
| 429 | The write limits below, or {"error":"Data store full"} when a new row would pass the 250000 row cap of the bot. |
| 503 | {"error":"Writes paused"} or {"error":"Try again later"}. Wait for the seconds in Retry-After, then retry with the same Idempotency-Key. |
The 409 codes. Check code.
| code | error | Meaning |
|---|---|---|
CAS_FAILED | Version mismatch | The row changed since the updatedAt you sent as ifUpdatedAt. The body has the row's updatedAt. Read the row again, then retry. |
SHAPE_MISMATCH | Shape mismatch | The row or the field does not hold a number: an object row with no field, a number row with a field, an array, a string, or a field that holds an object, array or string. The body has the row as data. Nothing changed. |
INSUFFICIENT | Insufficient | The result would be below 0 and allowNegative is not true. The body has the number as current. Nothing changed. |
VALUE_TOO_LARGE | Value too large | The result would pass 1000000000000000 in size. The body has current and max. Nothing changed. |
The 400 list above covers writes too. The write limits are in the Limits table above; a write also counts in the per-bot, per-account and per-IP limits.
Details
What a retry with the same key gets. A 200, a 409 SHAPE_MISMATCH, INSUFFICIENT or VALUE_TOO_LARGE, and a 413 Data too large are final and replay. The reply carries the header X-Idempotency-Replayed: true. A replayed data is the stored form. That form is a digest ({"_truncated":true,"bytes":...,"sha256":"..."}) when the row is over 8192 bytes of JSON. A 409 CAS_FAILED, a 429 and a 409 In progress are not stored under the key. Retry with the same key, and the write can go through. The same key with another body, or with a different guildId, answers 422. A key is remembered 90 days.
A leaked write key can change member data until you revoke it. What bounds it is the per-member write limit and the Recent writes list, not the by cap: min, max and a set can put any value in a row. Revoke the key at once, then make a new one.
Troubleshooting
- 401: the secret is wrong. Check your server env var.
- 404: the hook is paused, or the
botIdin the URL is not this bot. - 202 but nothing happens: the bot is offline, no behavior uses this hook, or the bot is VibeBot Basic. After you delete a hook and make a new one, update the behavior to the new URL.
- A code from your app does not redeem: your app did not post it to the hook, the bot was offline for more than 1 hour, your app sent more than 50 posts while the bot was offline (the bot keeps the 50 newest), or the webhook behavior saves it with a different key, data type or server than the redeem command reads. With the owner API, the PUT was refused for a bad code, or got 401 (a wrong or revoked API key), 403 (an API key without Allow writes), 409 (an AI Bot Builder chat is open on the bot) or 429 (a limit). Or the PUT saved the code with a different data type or server than the redeem command reads.
- fetch fails in the bot: the host is not public, the env var name does not match, or you did not press Put live after you added it.