Pirate Tok
Docs/Getting started/Getting started

Getting started

Connect to a TikTok LIVE room, receive your first event, and choose the right reference for your application.

Choose your library

Start with the language your application already uses. Each library guide includes its runtime requirements, installation method, event API and configuration.

Application Starting points
Node.js services and TypeScript applications JavaScript / TypeScript
Python applications and automation Python
Native services and typed event processing Rust, Go
.NET applications and Unity C#
JVM applications Java
Native Dart applications Dart
OTP applications Elixir
Game loops and native scripting Lua
C applications and foreign-function interfaces C / FFI
Command-line automation PowerShell, Shell

Run your first connection

  1. Install the library using its language guide. Some integrations use package registries; others use the public source directly.
  2. Replace username_here in the quickstart with an account that is currently live.
  3. Register event handlers before starting the connection.
  4. Run the example and send a chat message in the room to observe a chat event.
  5. Stop the client using the shutdown mechanism in the same guide.

The basic event connection obtains an anonymous ttwid cookie. You do not need a signing-service API key for that connection. A private session is a separate requirement for certain metadata calls, including the full audience roster.

Understand the session lifetime

Connection methods differ by language. In JavaScript, connect() resolves after the first successful WebSocket handshake and the event loop continues in the background. In Python, await client.connect() runs the session until it stops. Go returns an event channel; Rust returns an event stream after room resolution.

Use the connection lifecycle guide when integrating startup, reconnects and shutdown into an application.

Add room metadata when you need it

Room metadata is optional. Fetching the room title or stream URLs is separate from receiving LIVE events.

Read event data correctly

Use the fields documented for your language. Similar events may expose comment or content, and names may use snake_case or camelCase. Gift streak counters can be cumulative; a repeated message is not necessarily a new gift. Where available, use the library's gift-streak and like-accumulation helpers.

Find the next answer