💬

Connecting Telegram

Step-by-step guide to set up Telegram bot integration

8 min read
Configuration

Connecting Telegram

Want to chat with your AI agent on Telegram? Sweet! It's like having your personal assistant in your pocket. Here's how to set it up.

What You'll Need

  • A Telegram account (obviously)
  • About 5 minutes
  • Your PinchKit agent already set up
  • Step 1: Create a Telegram Bot

    First, you need to create a bot on Telegram. Don't worry, it's easier than making a sandwich.

    Talk to BotFather

    1. Open Telegram and search for @BotFather

  • Start a chat with BotFather (it's the official bot for creating bots)
  • 3. Send /newbot to start creating your bot

    Set Up Your Bot

    BotFather will ask you a few questions:

    Bot Name: This is what people see in chats. Something like "My AI Assistant" works great.

    **Username**: Must end with "bot" and be unique. Like myawesomeagent_bot

    Once you're done, BotFather will give you a Bot Token. It looks like this:

    code
    123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11

    Save this token! You'll need it in a minute.

    Step 2: Get Your Chat ID

    Your agent needs to know where to send messages. That's what the Chat ID is for.

    Find Your Chat ID

  • Send any message to your newly created bot
  • Go to this URL in your browser (replace YOUR_BOT_TOKEN with your actual token):
  • __CODEBLOCK_1__

    3. Look for the "id" field in the response. It's usually a number like 12345678

    Alternative Method

    If that seems too techy, you can also:

    1. Search for @userinfobot on Telegram

    2. Start a chat and send /start

  • It will tell you your Chat ID
  • Step 3: Connect to PinchKit

    Now for the fun part — connecting everything together.

    During Setup

    If you're creating a new agent, you can add these during the setup process:

    - Telegram Bot Token: Paste the token BotFather gave you

    - Telegram Chat ID: Enter your Chat ID from Step 2

    For Existing Agents

    If your agent is already running:

  • Go to your agent's dashboard
  • Click on "Settings"
  • Find the "Messaging" section
  • Add your Bot Token and Chat ID
  • Hit "Save Changes"
  • Your agent will restart and connect to Telegram within a minute or two.

    Step 4: Test It Out

    Time to see if everything works!

  • Go to your Telegram bot
  • Send a message like "Hello!"
  • Your agent should respond
  • If it doesn't respond within a few seconds, check our Troubleshooting guide.

    Pro Tips

    Custom Commands

    You can set up custom commands for your bot to make it feel more official:

    1. Go back to @BotFather

    2. Send /setcommands

  • Select your bot
  • Add some useful commands like:
  • __CODEBLOCK_2__

    Privacy Settings

    By default, your bot can only see messages sent directly to it. If you want to add it to groups, you'll need to:

    1. Go to @BotFather

    2. Send /setprivacy

  • Select your bot
  • Choose "Disable" to let it see all messages in groups
  • Bot Profile

    Make your bot look professional:

    1. **Set a description**: /setdescription - Tell people what your bot does

    2. **Add a profile picture**: /setuserpic - Upload a nice image

    3. **Set about text**: /setabouttext - Short description for the bot profile

    What Now?

    Your agent can now:

  • Respond to your messages on Telegram
  • Send you notifications and updates
  • Handle commands and requests
  • Work with all your installed plugins
  • Try asking it to:

  • "What's my GitHub activity today?"
  • "Deploy my latest project"
  • "What's the weather like?"
  • Troubleshooting

    Bot not responding?

  • Double-check your Bot Token and Chat ID
  • Make sure you sent at least one message to the bot first
  • Check if your agent is running in the dashboard
  • Messages not being delivered?

  • Verify the Chat ID is correct
  • Make sure the bot hasn't been blocked
  • Still having issues?

    Check out our Troubleshooting guide or ask the community.

    Nice work! Your agent is now just a Telegram message away 📱✨

    Was this helpful?