← Back to examples

Get started

  1. Install project dependencies with npm install.
  2. Run npx velho-setup to walk through the interactive OAuth helper, or manually create a .env file with the required credentials listed on this page.
  3. Give your bot account chat permissions by visiting the generated authorization URL and completing consent.
  4. Start the bot with npx tsx examples/CHAT_COMMAND_BOT.ts. The script validates your environment variables and connects to chat.
  5. Type commands such as !uptime, !title, or !help from the channel to see the bot respond.

What you can do

  • Listen for chat messages and filter them by channel or user roles.
  • Fetch uptime and title information via the Helix API and reply instantly in chat.
  • Handle reconnects and error conditions with informative logging for on-call teams.
  • Expand the handleCommand function to support moderation or loyalty workflows.

Operational tips

  • Swap autoJoin for a dynamic list if the bot needs to monitor multiple channels.
  • Persist the broadcaster ID instead of requesting it on every command to minimise Helix calls.
  • Combine this bot with EventSub notifications to announce follows, subs, and channel point rewards.