Connecting to Telegram
Using API Key Authentication
Telegram uses Bot Tokens to authenticate API requests. You can obtain a Bot Token by creating a bot via BotFather on Telegram (https://t.me/BotFather). Once created, BotFather will provide a token in the format 123456789:ABCdefGhIJKlmNoPQRsTUVwxyZ.
After setting the following connection properties, you are ready to connect:
- AuthScheme: Set this to APIKey.
- APIKey: Set this to your Telegram Bot Token obtained from BotFather.
Example connection string
Profile=C:\profiles\Telegram.apip;ProfileSettings='APIKey=your_bot_token';
Available Tables
The Telegram profile provides access to the following tables:
- AvailableGifts - Returns all gifts that can be sent by the bot
- BotCommands - Returns the list of the bot's commands for the given scope and user language
- BotDefaultAdminRights - Returns the default administrator rights of the bot
- BotDescription - Returns the bot description shown on the bot info page
- BotInfo - Returns basic information about the bot
- BotName - Returns the bot name
- BotShortDescription - Returns the bot short description shown on the Start page
- ChatAdministrators - Returns a list of administrators in a chat
- ChatInfo - Returns up-to-date information about a chat
- ChatMemberCount - Returns the number of members in a chat
- ChatMemberInfo - Returns information about a member of a chat
- CustomEmojiStickers - Returns information about custom emoji stickers by their identifiers
- Files - Returns basic information about a file
- ForumTopicIconStickers - Returns custom emoji stickers that can be used as forum topic icons
- StarTransactions - Returns Star transactions for the bot
- StickerSets - Returns a sticker set by name
- Updates - Returns incoming updates for the bot
- UserProfilePhotos - Returns a list of profile pictures for a user
Usage Examples
AvailableGifts:
SELECT * FROM AvailableGifts
BotCommands:
SELECT * FROM BotCommands
BotDefaultAdminRights:
SELECT * FROM BotDefaultAdminRights
BotDescription:
SELECT * FROM BotDescription
BotInfo:
SELECT * FROM BotInfo
BotName:
SELECT * FROM BotName
BotShortDescription:
SELECT * FROM BotShortDescription
ChatAdministrators:
SELECT * FROM ChatAdministrators WHERE ChatIdParam = '-1001234567890'
ChatInfo:
SELECT * FROM ChatInfo WHERE ChatIdParam = '-1001234567890'
ChatMemberCount:
SELECT * FROM ChatMemberCount WHERE ChatIdParam = '-1001234567890'
ChatMemberInfo:
SELECT * FROM ChatMemberInfo WHERE ChatIdParam = '-1001234567890' AND UserIdParam = '123456789'
CustomEmojiStickers:
SELECT * FROM CustomEmojiStickers WHERE CustomEmojiId = '5368324170671202286'
Files:
SELECT * FROM Files WHERE FileId = 'BQACAgIAAxkBAAIBXmZ...'
ForumTopicIconStickers:
SELECT * FROM ForumTopicIconStickers
StarTransactions:
SELECT * FROM StarTransactions
StickerSets:
SELECT * FROM StickerSets WHERE Name = 'Animals'
Updates:
SELECT * FROM Updates
UserProfilePhotos:
SELECT * FROM UserProfilePhotos WHERE UserId = '123456789'
Connection Properties
The connection string properties are the various options that can be used to establish a connection. This section provides a complete list of the options you can configure in the connection string for this provider.
| Property | Description |
| APIKey | The Bot Token for your Telegram bot. |
| AuthScheme | The scheme used for authentication. Accepted entries are APIKey or None. Allowed values are: BASIC, NONE, NTLM, OAUTH, APIKEY, OAUTH_CLIENT |