Simple API for managing Telegram bot webhooks
v1.0.0Loading...
All requests require an API token in the request body:
"api_token": "YOUR_API_TOKEN_HERE"
Create new bot webhook and configure Web App menu button
| 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/"
}'
Update existing bot's Web App URL
| 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/"
}'
Remove bot webhook and delete from storage
| 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"
}'
• 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
• 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
• Send POST request to /manage_webhook.php with type: "delete"
• Webhook is removed via Telegram API
• Bot token is removed from storage
| 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) |