📡 Telegram Bot Webhook Manager

Simple API for managing Telegram bot webhooks

v1.0.0

Overview

Base URL

Loading...

Authentication

All requests require an API token in the request body:

"api_token": "YOUR_API_TOKEN_HERE"

API Examples

POST /manage_webhook.php Add new bot â–¼

Create new bot webhook and configure Web App menu button

Request Parameters

Parameter Type Description
api_token * required string API authentication token
type * required string Action type: "add"
bot_token * required string Telegram bot token from @BotFather
app_url * required string Web App URL (HTTPS only)

Request Example:

{
  "api_token": "YOUR_API_TOKEN_HERE",
  "type": "add",
  "bot_token": "1234567890:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  "app_url": "https://your-app.com/"
}

200 Success Response:

{
  "success": true,
  "webhook": "https://your-domain.com/webhook_XXXXXXXX.php",
  "message": "Webhook set successfully",
  "menu_button_set": true
}

400 Error Response:

{
  "success": false,
  "error": "bot_token is required"
}

403 Error Response:

{
  "success": false,
  "error": "Invalid API token"
}

cURL Example:

curl -X POST https://your-domain.com/manage_webhook.php \
  -H "Content-Type: application/json" \
  -d '{
    "api_token": "YOUR_API_TOKEN_HERE",
    "type": "add",
    "bot_token": "1234567890:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    "app_url": "https://your-app.com/"
  }'
POST /manage_webhook.php Update bot app URL â–¼

Update existing bot's Web App URL

Request Parameters

Parameter Type Description
api_token * required string API authentication token
type * required string Action type: "update"
bot_token * required string Telegram bot token from @BotFather
app_url * required string New Web App URL (HTTPS only)

Request Example:

{
  "api_token": "YOUR_API_TOKEN_HERE",
  "type": "update",
  "bot_token": "1234567890:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  "app_url": "https://new-app-url.com/"
}

200 Success Response:

{
  "success": true,
  "message": "Bot app_url updated successfully",
  "menu_button_updated": true
}

404 Error Response:

{
  "success": false,
  "error": "Bot not found. Please add the bot first."
}

403 Error Response:

{
  "success": false,
  "error": "Invalid API token"
}

cURL Example:

curl -X POST https://your-domain.com/manage_webhook.php \
  -H "Content-Type: application/json" \
  -d '{
    "api_token": "YOUR_API_TOKEN_HERE",
    "type": "update",
    "bot_token": "1234567890:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    "app_url": "https://new-app-url.com/"
  }'
POST /manage_webhook.php Delete bot â–¼

Remove bot webhook and delete from storage

Request Parameters

Parameter Type Description
api_token * required string API authentication token
type * required string Action type: "delete"
bot_token * required string Telegram bot token from @BotFather

Request Example:

{
  "api_token": "YOUR_API_TOKEN_HERE",
  "type": "delete",
  "bot_token": "1234567890:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
}

200 Success Response:

{
  "success": true,
  "message": "Webhook deleted successfully"
}

404 Error Response:

{
  "success": false,
  "error": "Bot not found"
}

403 Error Response:

{
  "success": false,
  "error": "Invalid API token"
}

cURL Example:

curl -X POST https://your-domain.com/manage_webhook.php \
  -H "Content-Type: application/json" \
  -d '{
    "api_token": "YOUR_API_TOKEN_HERE",
    "type": "delete",
    "bot_token": "1234567890:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
  }'

How It Works

1. Add Bot

• Send POST request to /manage_webhook.php with type: "add" and app_url

• Webhook is configured automatically

• Web App menu button is created with your app URL

• Bot token and app URL are saved to secure storage

2. Bot Receives Messages

• Users send messages to your bot

• Bot responds with image and inline keyboard

• "Play" button opens your Web App

• Supports both Russian and English languages

3. Remove Bot

• Send POST request to /manage_webhook.php with type: "delete"

• Webhook is removed via Telegram API

• Bot token is removed from storage

Error Codes

Code Description
200 Success
400 Bad Request - Missing required fields or invalid bot token
403 Forbidden - Invalid API token
404 Not Found - Bot not found (for update)