BetterFans Link SDK — OnlyFans APIBetterFans Link SDK
WebSocket

Event reference

Complete reference of all EventBus event types and their payloads.

The EventBus emits typed events as they occur across your managed accounts. Each event includes the accountId of the account it originated from.

Event types

EventDescription
chat_messageA new chat message was received or sent
system_messageA system-generated message (auto-replies, welcome messages)
onlineAn account's online status changed
countsUnread counts updated (chats, notifications)
typingA user started or stopped typing in a chat
chat_message_likeA chat message was liked
chat_message_unlikeA chat message was unliked
tipA tip was received
new_subscriberA new user subscribed
returning_subscriberA previously expired subscriber resubscribed
ppv_purchaseA pay-per-view message was purchased
ppv_sentA pay-per-view message was sent

Event payloads

Every event handler receives a typed payload. Here are the most common events and their key fields.

chat_message

Fired when a message is received in any chat.

ws.on("chat_message", (event) => {
  event.accountId     // string — which account received it
  event.id            // number — message ID
  event.text          // string — message text
  event.fromUser      // object — sender info
  event.toUser        // object — recipient info
  event.price         // number — price if PPV
  event.media         // array — attached media
  event.createdAt     // string — ISO timestamp
})

tip

Fired when a tip is received on any account.

ws.on("tip", (event) => {
  event.accountId     // string — which account received it
  event.amount        // number — tip amount
  event.userId        // string — who tipped
  event.message       // string — optional tip message
})

new_subscriber

Fired when someone subscribes to one of your accounts.

ws.on("new_subscriber", (event) => {
  event.accountId     // string — which account got a subscriber
  event.userId        // string — new subscriber's user ID
})

returning_subscriber

Fired when a previously expired subscriber resubscribes.

ws.on("returning_subscriber", (event) => {
  event.accountId     // string
  event.userId        // string
})

ppv_purchase

Fired when a user purchases a pay-per-view message.

ws.on("ppv_purchase", (event) => {
  event.accountId     // string
  event.messageId     // number
  event.userId        // string
  event.amount        // number
})

online

Fired when an account's online status changes.

ws.on("online", (event) => {
  event.accountId     // string
  event.online        // boolean
})

typing

Fired when a user starts or stops typing.

ws.on("typing", (event) => {
  event.accountId     // string
  event.userId        // string — who is typing
  event.chatId        // string
})

counts

Fired when unread counts change.

ws.on("counts", (event) => {
  event.accountId     // string
  event.unreadChats   // number
})

TypeScript types

All event types are exported for use in your own type definitions:

import type {
  BusEventMap,
  BusEventType,
  BusChatMessageEvent,
  BusOnlineEvent,
  BusEventEnvelope,
} from "@betterfans/link-sdk"

type MyHandler = (event: BusChatMessageEvent) => void

The BusEventMap type maps event names to their payload types, so you can build generic event handling:

function handleEvent<T extends BusEventType>(
  type: T,
  handler: (event: BusEventMap[T]) => void,
) {
  ws.on(type, handler)
}

On this page