Skip to main content

Introduction

This tutorial guides you through creating and configuring a Telegram bot in OpenClaw Manager. Once complete, your Telegram Bot will be powered by APIMart’s AI models for intelligent conversations.
Prerequisites: Please ensure you have completed the OpenClaw Manager deployment and the Manager is running with the management UI accessible.

Step 1: Create a Bot on Telegram

  1. Open Telegram, search for @BotFather and start a conversation
Search BotFather
  1. Send the /newbot command
Send /newbot command
  1. Enter your bot’s display name as prompted (e.g. My AI Bot)
Enter bot name
  1. Enter the bot’s username (must end with bot, e.g. my_ai_chatbot)
Enter bot username
  1. BotFather will return a Bot Token (format: 123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11), copy and save it
Get Bot Token
Keep your Bot Token secure and do not share it. If the token is compromised, use the /revoke command in BotFather to regenerate it.

Step 2: Create Instance in Manager

  1. Open the OpenClaw Manager UI (http://127.0.0.1:51942)
  2. Click + New Instance
New Instance
  1. Enter instance name — e.g. my-telegram-bot (letters, numbers, underscores, hyphens only)
Enter instance name
  1. Select AI model — Choose the model you want to use
Select model
  1. Enter APIMart API Key — Enter your API key starting with sk-
Enter API Key
  1. Select channel — Choose Telegram
  2. Paste Bot Token — Paste the Bot Token obtained in Step 1
Configure Telegram channel
  1. Click Create to complete instance creation

Step 3: Pairing Code Binding

After the instance is created and started, complete user authorization via pairing code:
  1. Search for your bot’s username in Telegram
  2. Send any message (e.g. “Hello”)
  3. The bot will reply with an 8-digit pairing code (e.g. DFE62DTD)
Get pairing code
  1. Return to the Manager’s new instance wizard, enter the pairing code in the “Enter Pairing Code” step and click “Approve
Enter pairing code
  1. After the code is approved, click “Done
Pairing approved
  1. Return to Telegram, send another message, and the bot will respond with AI-generated content
Chat with bot
Tip: Pairing codes are stored in Gateway memory and expire after Gateway restart. If a code expires, simply have the user send a new message to get a fresh code.

FAQ

Q1: Bot created successfully but not responding?

Solutions:
  1. Confirm the instance status is “Running” in Manager
  2. Confirm Bot Token is entered correctly
  3. Check Gateway logs: ~/.openclaw-<instance-name>/logs/gateway.log

Q2: Pairing code approval failed?

Solutions:
  • Confirm Gateway is running
  • Pairing codes are case-sensitive, double check carefully
  • Codes expire after Gateway restart, have the user send a new message

Back to OpenClaw Manager Deployment Guide

View the complete guide for Manager installation, deployment and instance management