Gateway
Last updated 4 October 2026
The gateway tells your bot what happens in its servers. It's a simple long-poll: ask, wait up to 25 seconds, get everything new.
How it works
- Say hello
GET /gatewayreturns your currentcursor. - Wait for events
GET /gateway?cursor=N&wait=25answers as soon as something happens, or after 25 seconds with nothing. - Move the cursorSave the new
cursorfrom each answer and ask again. Missed events wait for you for 24 hours.
HelloResponse
GET /gateway { "op": "hello", "cursor": 1042, "wait_max": 25 }
DispatchResponse
GET /gateway?cursor=1042&wait=25 { "op": "dispatch", "cursor": 1043, "events": [ { "id": 1043, "type": "MESSAGE_CREATE", "data": { ... } } ] }
The loop
Node.js 18+bot.js
const API = 'https://paw-talk.xyz/api/v1'; const H = { Authorization: 'Bearer ' + process.env.TOKEN }; let { cursor } = await (await fetch(API + '/gateway', { headers: H })).json(); while (true) { const r = await (await fetch(API + `/gateway?cursor=${cursor}&wait=25`, { headers: H })).json(); for (const ev of r.events) handle(ev); // your code cursor = r.cursor; // save it - restart from here }
TipSave the cursor to disk. When your bot restarts, it picks up exactly where it stopped.
Events
| Event | When | Needs |
|---|---|---|
MESSAGE_CREATE | A message is posted | message content for the text |
MESSAGE_UPDATE | A message is edited | message content |
MESSAGE_DELETE | A message is deleted | |
REACTION_ADD / REACTION_REMOVE | Someone reacts | |
MEMBER_JOIN / MEMBER_LEAVE | Someone joins or leaves | server members |
MEMBER_UPDATE | Roles or nickname change | server members |
VOICE_STATE | Someone joins or leaves voice | |
INTERACTION_CREATE | A command or button is used | |
POLL_UPDATE | A vote is cast | |
GIVEAWAY_END | A giveaway is drawn |
Every event with its fields: GET /events/catalog
Intents
Some data is private by default. Turn these on for your bot in the Developer Portal:
Message contentThe text of messages. Without it, message events arrive without
content.Server membersJoin, leave and member update events.
Bots only hear what they can seeEvents only come from channels the bot has permission to view. If a server pauses its bots, events stop until it resumes them.