Realtime API
Versions
- V3:
wss://api.inline.chat/realtime/v3— Inline Protocol keys; current. - V2:
wss://api.inline.chat/realtime— bearer token; compatibility.
Install
Bun:
bun add @inline-chat/realtime-sdknpm:
npm install @inline-chat/realtime-sdkV2 Quick Start
Set INLINE_TOKEN and INLINE_CHAT_ID. Save as send-realtime.ts:
TypeScript
import { InlineSdkClient } from "@inline-chat/realtime-sdk"
const token = process.env.INLINE_TOKEN
const chatId = process.env.INLINE_CHAT_ID
if (!token || !chatId) throw new Error("Set INLINE_TOKEN and INLINE_CHAT_ID")
const client = new InlineSdkClient({ token })
try {
await client.connect()
await client.sendMessage({ chatId: BigInt(chatId), text: "Hello over Realtime" })
} finally {
await client.close()
}Run it:
bun run send-realtime.tsVerify the message in Inline.
V3
V3 requires inlineProtocol.credentials with permanent and bound temporary authorization keys. A bearer token cannot authenticate V3.