Skip to content

Latest commit

 

History

History
721 lines (479 loc) · 14.4 KB

File metadata and controls

721 lines (479 loc) · 14.4 KB

Step 5: Telegram Bot Setup

This guide will help you create a private Telegram bot to control your Clawdbot remotely, receive notifications, and interact with your local AI from anywhere.

Overview

By connecting Clawdbot to Telegram, you can:

  • Send commands to your bot from your phone or any device
  • Receive proactive notifications (alerts, reminders, updates, etc.)
  • Control your local computer remotely (open apps, run scripts, take screenshots)
  • Schedule automated tasks via natural language
  • Access your AI assistant like ChatGPT, but completely private and running locally
  • Automate web research, monitoring, and data collection
  • Get real-time updates from automated workflows

Important: This setup creates a PRIVATE bot that only YOU can use. No one else can message it or see your conversations.

Prerequisites

Part 1: Create Your Telegram Bot

Open BotFather

BotFather is Telegram's official bot for creating bots:

  1. Open Telegram
  2. Search for @BotFather
  3. Click on the verified BotFather (blue checkmark)
  4. Click Start

Create a New Bot

  1. Send the command: /newbot

  2. Choose a name (this is the display name):

    My Clawdbot Assistant
    
  3. Choose a username (must end in 'bot'):

    my_clawdbot_assistant_bot
    

    (If taken, try adding numbers: my_clawdbot_2026_bot)

  4. Copy your Bot Token - BotFather will send you a message like:

    Done! Here is your bot token:
    123456789:ABCdefGHIjklMNOpqrsTUVwxyz123456789
    

    Save this token securely! You'll need it in the next steps.

Customize Your Bot (Optional)

Make your bot more personal:

Set a description:

/setdescription

Choose your bot, then send:

Your personal AI assistant powered by local Ollama models. Private and secure.

Set a profile picture:

/setuserpic

Choose your bot and upload an image.

Set commands:

/setcommands

Choose your bot and send:

start - Start the bot
help - Show available commands
search - Search the web
jobs - Check for new jobs
tasks - View scheduled tasks
stop - Stop current task
status - Check bot status

Part 2: Get Your Telegram User ID

For security, you need to restrict the bot to only respond to YOU.

Use UserInfoBot

  1. Search for @userinfobot in Telegram

  2. Click Start

  3. The bot immediately replies with your information:

    Id: 987654321
    First Name: Your Name
    Username: @yourusername
    
  4. Copy your User ID (the number, e.g., 987654321)

Alternative Method:

  1. Search for @raw_data_bot
  2. Click Start
  3. Look for "id": 987654321 in the JSON response

Part 3: Configure Clawdbot for Telegram

Method 1: Using Clawdbot CLI (Recommended)

# Set the bot token
clawdbot config set channels.telegram.botToken "123456789:ABCdefGHIjklMNOpqrsTUVwxyz123456789"

# Restrict to only YOUR user ID (replace with your actual ID)
clawdbot config set channels.telegram.allowFrom ["987654321"]

# Set DM policy to restricted (extra security)
clawdbot config set gateway.dmPolicy "restricted"

Method 2: Manual Configuration

Open your Clawdbot configuration file:

  • Windows: %APPDATA%\clawdbot\config.yaml
  • macOS/Linux: ~/.config/clawdbot/config.yaml

Add or update the Telegram configuration:

channels:
  telegram:
    enabled: true
    botToken: "123456789:ABCdefGHIjklMNOpqrsTUVwxyz123456789"
    allowFrom:
      - 987654321 # Your User ID only
    # Optional: Add more user IDs for family members
    # - 111222333  # Another trusted user

gateway:
  dmPolicy: "restricted" # Only approved users can chat

Important: Replace the botToken with YOUR token from Part 1 and the allowFrom ID with YOUR User ID from Part 2.

Part 4: Pair Your Bot

Restart Clawdbot

clawdbot gateway stop
clawdbot gateway start --daemon

Start the Bot in Telegram

  1. Open Telegram

  2. Search for your bot (e.g., @my_clawdbot_assistant_bot)

  3. Click Start

  4. You should receive a pairing code like:

    Welcome! Your pairing code is: JN4MSY
    
    Please ask the administrator to approve this pairing.
    

Approve the Pairing

On your computer, run:

clawdbot pairing approve telegram JN4MSY

(Replace JN4MSY with your actual pairing code)

You should see:

✓ Approved telegram sender 987654321

Verify Connection

In Telegram, send a message to your bot:

Hello!

Your bot should respond! If it does, your setup is complete.

Part 5: Test Basic Commands

Simple Interaction Test

Try these messages:

  1. Basic AI question:

    What is 2+2?
    
  2. Current information (requires Brave MCP from Step 2):

    Search the web for today's weather in Tokyo
    
  3. Browser automation (requires Playwright from Step 3):

    Open my browser and go to google.com
    
  4. System status:

    /status
    

Check Dashboard Integration

  1. Open Clawdbot dashboard: http://localhost:18789
  2. Navigate to Channels or Telegram section
  3. You should see:
    • Status: Connected
    • Active Users: 1
    • Recent Messages: Your test messages

Part 6: Set Up Automated Tasks

Now that Telegram is connected, you can configure various automated workflows.

Example 1: News Digest Automation

Send this message to your bot in Telegram:

Set your system instruction to:

You are my News Digest Assistant. Your goal is to keep me informed about topics I care about.

Your Rules:
1. Use the Brave Search tool to find recent news articles
2. Focus on articles from the last 24 hours
3. Filter for reputable sources
4. Provide a brief summary (2-3 sentences) and a link for each article
5. Organize by topic
6. If nothing significant is found, send a brief "No major updates today" message

My Topics of Interest:
- Artificial Intelligence and Machine Learning
- Space Exploration
- Renewable Energy
- [Add your interests]

Schedule the news digest:

Schedule a task: Every day at 8:00 AM, search for news on my topics of interest and send me a digest.

Example 2: Price Tracking

Schedule a task: Every 6 hours, check the price of [Product Name] on [Website]. If it drops below $[amount], alert me immediately with a link.

Example 3: Website Monitoring

Schedule a task: Every day at 2:00 PM, check [website URL] for new content. If there are updates, send me a summary of what's new.

Example 4: Social Media Monitoring

Schedule a task: Every 4 hours, search Twitter for mentions of "[your brand/keyword]" and send me any posts with significant engagement.

Example 5: Job Search Automation

Schedule a task: Every day at 9:00 AM and 5:00 PM, search [job boards] for [Job Title] positions matching my criteria and send me the top 3 matches.

The bot should confirm:

✓ Understood. I've scheduled your automated task.

Part 7: Manage Scheduled Tasks

View Active Tasks

/tasks

or

What tasks do you have scheduled?

Stop a Task

Stop the daily job search task

Stop All Tasks

/stopall

Modify a Task

Change the job search schedule to only once per day at 10 AM

Part 8: Advanced Features

Proactive Notifications

Beyond job searches, you can set up any automated notifications:

News Digest:

Every morning at 8 AM, search for the top 3 AI news stories and send me a summary

Price Tracking:

Every 4 hours, check the price of Bitcoin and alert me if it goes above $50,000

Reminders:

Every Friday at 5 PM, remind me to review my weekly goals

Browser Control via Telegram

If you completed Step 3 (Playwright), you can control your computer's browser:

Open and Search:

Open LinkedIn and search for Remote Python Developer jobs

Take Screenshots:

Navigate to github.com/trending and send me a screenshot

Automated Workflows:

Open my email, check for unread messages, and tell me how many I have

Local Computer Control

With appropriate MCP servers, you can:

Open Applications:

Open Spotify and play my Chill Mix playlist

System Information:

Check my computer's CPU and RAM usage

File Operations:

Create a new file called 'meeting-notes.txt' on my desktop

Part 9: Security and Privacy

Verify Bot is Private

Test with another account:

  1. Ask a friend to search for your bot
  2. Have them send a message
  3. They should receive NO response

Check allowed users:

clawdbot config get channels.telegram.allowFrom

Should only show YOUR User ID.

Approve Additional Users (Family/Team)

If you want to share with trusted people:

clawdbot config set channels.telegram.allowFrom ["987654321", "111222333"]

Or edit config.yaml:

allowFrom:
  - 987654321 # You
  - 111222333 # Trusted person

Revoke Access

Remove a user ID from the allowFrom list and restart:

clawdbot gateway restart

Monitor Bot Activity

View recent messages:

clawdbot logs telegram

Dashboard monitoring: Open dashboard at http://localhost:18789 > Telegram section

Bot Token Security

Never share your bot token:

  • It grants full control of your bot
  • Anyone with the token can send messages as your bot

If compromised:

  1. Go to BotFather on Telegram
  2. Send /token
  3. Choose your bot
  4. Generate new token
  5. Update Clawdbot config with new token

Troubleshooting

Bot Doesn't Respond

Check gateway is running:

clawdbot gateway status

Verify bot token:

clawdbot config get channels.telegram.botToken

Should match the token from BotFather.

Check logs:

clawdbot gateway logs | grep telegram

Look for connection errors.

"Unauthorized" or "Forbidden" Errors

Verify your User ID is in allowFrom list:

clawdbot config get channels.telegram.allowFrom

Re-pair the bot:

clawdbot pairing list telegram
clawdbot pairing approve telegram [YOUR_PAIRING_CODE]

Pairing Code Never Received

Check bot username is correct:

  • Search for the exact username from BotFather
  • Ensure it ends with _bot

Restart gateway:

clawdbot gateway restart

Check Telegram connection in dashboard: Open http://localhost:18789 and verify Telegram status.

Job Searches Not Working

Verify Brave MCP is configured: See Step 2: Brave MCP Setup

Check system instructions:

Show me your current system instructions

Test search manually:

Search the web for React Developer jobs

If this works but scheduled tasks don't, check task logs:

clawdbot logs tasks

Bot Responds Slowly

This is normal for complex tasks:

  • Ollama needs time to process
  • Web searches add latency
  • Browser automation can take 10-30 seconds

To improve speed:

  • Use a faster model (e.g., mistral-small)
  • Simplify your prompts
  • Increase RAM allocated to Ollama

Messages Not Delivering

Check internet connection: Both your computer and phone need internet.

Verify Telegram isn't blocked: Some corporate networks block Telegram.

Check gateway firewall: Ensure outbound connections to Telegram API are allowed.

Tips for Better Interactions

Be Specific

Good:

Search LinkedIn for Remote Senior React Developer jobs posted in the last 24 hours that mention TypeScript

Bad:

Find me a job

Use Context

I'm looking for a React Developer role. My skills include React, TypeScript, Node.js, and GraphQL. I have 5 years of experience and I'm open to remote positions with a salary range of $100k-$140k.

Search for jobs that match this profile.

Break Down Complex Tasks

Instead of:

Search for jobs, filter them, apply to the top 3, and send me confirmation

Do:

1. Search for jobs matching my profile
2. [Wait for results]
3. Apply to the first job from the list you sent

Use Quiet Hours

To avoid notifications at night:

Don't send me job alerts between 10 PM and 8 AM

Next Steps

Congratulations! Your complete Clawdbot system is now operational. You have:

✅ Local AI powered by Ollama (no cloud costs)
✅ Internet search via Brave MCP
✅ Browser automation via Playwright
✅ Secure remote access via Tailscale
✅ Private bot control via Telegram

What to Do Next

  1. Customize your job search prompts based on your actual requirements

  2. Experiment with automation:

    • News digests
    • Price tracking
    • Productivity reminders
  3. Explore additional MCP servers:

    • Spotify control
    • Calendar integration
    • Email monitoring
    • File management
  4. Join the community:

    • Share your setup
    • Learn from others
    • Contribute improvements

Example Complete Workflow

Here's an example of a fully automated daily assistant workflow:

Morning Routine:
- 7:00 AM: Bot sends weather forecast and calendar reminders
- 8:00 AM: Bot sends personalized news digest on your topics
- 9:00 AM: Bot checks your monitoring tasks (prices, websites, social media)

Afternoon Check:
- 2:00 PM: Bot checks for website updates you're tracking
- 3:00 PM: Bot sends a summary of any price drops on items you're watching

Evening:
- 6:00 PM: Bot sends a digest of the day's findings
- 8:00 PM: You can ask for specific research or automation tasks
- Bot executes browser automation for any ad-hoc requests

Custom Automations:
- Job searching (if actively looking)
- Social media monitoring
- Content creation reminders
- System maintenance tasks
- File management
- Any workflow you can describe

All completely automated, private, and running on your own hardware.

Additional Resources

Feedback and Contributions

Found this guide helpful? Have suggestions for improvements?

  • Open an issue on this repository
  • Submit a pull request with enhancements
  • Share your setup with the community

← Back to Step 4 | Main README

🎉 Setup Complete! Enjoy your private, local AI assistant!