Telegram API
Send Telegram messages securely via API. Perfect for notifications, alerts, and automated messaging.
Overview
API Plugin's Telegram API provides a secure way to send messages through Telegram. Ideal for sending notifications, alerts, updates, and automated messages to users, groups, or channels.
Key benefits include:
- Secure message sending
- Channel & group support
- Rich message formatting
- File attachment support
- Automated notifications
- Easy integration
- Reliable delivery
How to Setup
We assume you have signed up on API Plugin and are logged into the dashboard.
-
Create a Telegram Bot:
- Open Telegram and search for "@BotFather"
- Send "/newbot" command
- Follow instructions to create your bot
- Copy the bot token provided
-
Configure API:
- Go to API Plugin marketplace
- Select Telegram API
- Input your bot token
- Create API endpoint
Available Endpoints
- Send Message
POST /v1/{appId}/{token}/message
Parameters:
chat_id
(required): Recipient's chat IDtext
(required): Message textparse_mode
: Message format (HTML/Markdown)
Example Request:
{
"chat_id": "123456789",
"text": "Hello from API Plugin!",
"parse_mode": "HTML"
}
- Send File
POST /v1/{appId}/{token}/file
Parameters:
chat_id
(required): Recipient's chat IDfile_url
: URL of file to sendcaption
: File caption
- Get Updates
GET /v1/{appId}/{token}/updates
Returns recent bot updates, including messages and chat IDs.
Message Formatting
- HTML Format
<b>Bold text</b>
<i>Italic text</i>
<code>Monospace text</code>
<a href="http://example.com">Link text</a>
- Markdown Format
_Bold text_
_Italic text_
`Monospace text`
[Link text](http://example.com)
Example Code
// Send message
const response = await fetch('/v1/{appId}/{token}/message', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
chat_id: '123456789',
text: '<b>Important Update!</b>\nSystem status: Online',
parse_mode: 'HTML',
}),
});
// Get updates
const updates = await fetch('/v1/{appId}/{token}/updates');
const chatIds = updates.data.map((update) => update.message.chat.id);