Documentation Index
Fetch the complete documentation index at: https://tiktools.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Installation
npm install @tiktool/live
Quick Start
import { TikTokLive } from '@tiktool/live';
const client = new TikTokLive({
apiKey: process.env.TIKTOOL_API_KEY,
uniqueId: 'streamer_username',
});
client.on('connected', () => console.log('Connected!'));
client.on('chat', (event) => console.log(`${event.user.uniqueId}: ${event.comment}`));
client.on('gift', (event) => console.log(`${event.user.uniqueId} sent ${event.giftName}`));
client.on('like', (event) => console.log(`${event.user.uniqueId} liked × ${event.likeCount}`));
await client.connect();
Configuration
| Option | Type | Default | Description |
|---|
apiKey | string | — | Your TikTool API key |
uniqueId | string | — | TikTok username to connect to |
enableExtendedGiftInfo | boolean | false | Fetch full gift details (image, diamond values) |
requestPollingIntervalMs | number | 1000 | Polling interval for HTTP mode |
Events
All events from the WebSocket Events reference are available:
client.on('chat', (event) => { /* chat message */ });
client.on('gift', (event) => { /* virtual gift */ });
client.on('like', (event) => { /* likes */ });
client.on('member', (event) => { /* viewer joined */ });
client.on('follow', (event) => { /* new follower */ });
client.on('share', (event) => { /* stream shared */ });
client.on('roomUserSeq', (event) => { /* viewer count update */ });
client.on('subscribe', (event) => { /* new subscriber */ });
client.on('linkMicBattle', (event) => { /* battle update */ });
client.on('emote', (event) => { /* animated emote */ });
client.on('envelope', (event) => { /* treasure box */ });
client.on('questionNew', (event) => { /* Q&A question */ });
Source Code
GitHub Repository
MIT-licensed. Full source code available.