Skip to content

Telegram Setup

Create a Telegram Bot

  1. Open Telegram and search for @BotFather
  2. Send /newbot
  3. Choose a name: NIKI Server (or any name)
  4. Choose a username: niki_yourname_bot (must end in bot)
  5. Copy the bot token - looks like 123456789:ABCdefGHI...

Get Your Chat ID

Your chat ID identifies where to send notifications.

Method 1: Use NIKI (easiest)

Terminal window
niki config init
# Follow the prompts - it will help you get your chat ID

Method 2: Manual

  1. Message your bot on Telegram (send /start)
  2. Run this command (replace YOUR_TOKEN):
Terminal window
curl -s "https://api.telegram.org/botYOUR_TOKEN/getUpdates" | python -c "
import sys, json
data = json.load(sys.stdin)
for r in data.get('result', []):
chat = r.get('message', {}).get('chat', {})
if chat:
print(f'Chat ID: {chat.get(\"id\")}')"

Configure NIKI

Add to ~/.niki/config.toml:

[notifications.telegram]
enabled = true
bot_token = "123456789:ABCdefGHI..."
allowed_user_ids = [YOUR_CHAT_ID]

Test It

Terminal window
niki daemon restart
niki watch -- echo "Hello from NIKI"

You should receive a notification!

Telegram Commands

Once configured, you can interact with NIKI via Telegram:

CommandDescription
statusShow running tasks
tasksList recent tasks
historyQuery task history
run <description>Run a command
rerunRerun last task
ask <question>Ask about tasks

Security

NIKI uses multiple security layers:

  • Whitelist: Only your chat ID can interact
  • Rate limiting: Max 5 commands/minute
  • Blocklist: Dangerous commands blocked
  • Confirmation: Commands require Y/N before execution

See Security Documentation for details.