Connect Telegram directly
Connect a Telegram channel/group directly using the chat ID. Alternative to the access code flow. The bot must already be an admin in the channel/group.
API key authentication - use your Zernio API key as a Bearer token
In: header
The Telegram chat ID. Numeric ID (e.g. "-1001234567890") or username with @ prefix (e.g. "@mychannel").
The profile ID to connect the account to
Response Body
application/json
application/json
import Zernio from '@zernio/node';const zernio = new Zernio({ apiKey: process.env.ZERNIO_API_KEY });const { data } = await zernio.connect.telegram.initiateTelegramConnect({ body: { chatId: 'chat_abc123', profileId: 'profile_abc123', },});console.log(data);{
"message": "Telegram channel connected successfully",
"account": {
"_id": "64e1f0a9e2b5af0012ab34cd",
"platform": "telegram",
"username": "mychannel",
"displayName": "My Channel",
"isActive": true,
"chatType": "channel"
}
}{
"error": "Unauthorized"
}Generate Telegram code GET
Generate an access code (valid 15 minutes) for connecting a Telegram channel or group. Add the bot as admin, then send the code + @yourchannel to the bot. Poll PATCH /v1/connect/telegram to check status.
Check Telegram status PATCH
Poll this endpoint to check if a Telegram access code has been used to connect a channel/group. Recommended polling interval: 3 seconds. Status values: pending (waiting for user), connected (channel/group linked), expired (generate a new code).