Telegram Bot Setup REST API
Telegram Bot Setup REST API for SMSGatewayCenter APIs
Telegram Bot Setup REST API
Use the Bot Setup REST API to connect or update your Telegram bot over HTTP: save bot credentials, register the inbound webhook, and get the chat deep link used for QR codes. Use GET for get, and POST for save and registerwebhook. Responses are JSON.
The API returns botChatUrl so mobile and third-party apps can generate the same QR code client-side from https://t.me/{botHandle}. There is no server-side QR image endpoint.
API Endpoint
https://unify.smsgateway.center/rest/tg/v1/setupLegacy alias without v1 in the path is also supported: /rest/tg/setup
Authentication
Send your account userid with either password as a request parameter, or your account API key in the apikey request header. userid is required in both cases. Password is not required when the apikey header is used. Telegram Chat API access must be enabled on your account.
Actions
| action | Method | Description |
|---|---|---|
get | GET | Return current bot connection status, flags, and botChatUrl for QR. Aliases: empty, list, status. |
save | POST | Create or update the bot, then register the inbound webhook. Aliases: connect, update. |
registerwebhook | POST | Re-register the inbound webhook. Aliases: register_webhook, webhook. |
| Parameter | Required | Description | Example/Value |
|---|---|---|---|
| Authentication | |||
| userid | Yes | Your SMSGatewayCenter account username. Required even when the apikey header is used. | YourUsername |
| password | Yes* | Your account password. Not required when the apikey header is used. | ********** |
| output | Yes | Response format. Must be json. | json |
| Setup Parameters | |||
| action | Optional | Defaults to get. | save |
| botName | For save | Display name (2-100 characters). | My Store Support |
| botHandle | Optional | Bot username without @ (4-32 letters, numbers, underscore). Used for https://t.me/{handle}. | mystorebot |
| botToken | Create only | Telegram bot token (digits:token). Optional on update to keep the existing token. | 123456789:AA...YOUR_BOT_TOKEN |
curl --location 'https://unify.smsgateway.center/rest/tg/v1/setup?userid=YourUsername&password=xxxxx&output=json&action=get'
curl --location --request POST 'https://unify.smsgateway.center/rest/tg/v1/setup?userid=YourUsername&password=xxxxx&output=json&action=save' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'botName=My Store Support' \
--data-urlencode 'botHandle=mystorebot' \
--data-urlencode 'botToken=123456789:AA...YOUR_BOT_TOKEN'
curl --location --request POST 'https://unify.smsgateway.center/rest/tg/v1/setup' \
--header 'apikey: YOUR_API_KEY' \
--data-urlencode 'userid=YourUsername' \
--data-urlencode 'output=json' \
--data-urlencode 'action=registerwebhook'
{
"status": "success",
"setup": {
"isConfigured": true,
"isActive": true,
"formMode": "update",
"botName": "My Store Support",
"botHandle": "mystorebot",
"botChatUrl": "https://t.me/mystorebot",
"hasBotToken": true,
"tps": 10,
"canRegisterWebhook": true,
"uiSendingEnabled": true,
"apiAccessEnabled": true,
"maxAgents": 5,
"saved": true,
"webhook": {
"status": "success",
"message": "Webhook registered successfully."
}
},
"statusCode": "200",
"reason": "Your Telegram bot has been connected and the webhook registered."
}
{
"status": "error",
"setup": [],
"statusCode": "403",
"reason": "Telegram API access is not enabled for this account."
}
