Telegram
Telegram
Configure the OwlStack WordPress plugin to publish posts to your Telegram channels and groups.
Prerequisites
Before configuring the plugin, you need a Telegram bot and a target channel or group.
Creating a Telegram Bot
- Open Telegram and search for @BotFather
- Send
/newbotand follow the prompts to choose a name and username - Copy the API token provided by BotFather
- Add your bot as an administrator to your target channel or group
Bot Permissions
Your bot must be an admin of the target channel/group to send messages. If using a private channel, use the channel's numeric chat ID instead of the username.
Settings
Navigate to OwlStack > Telegram in the WordPress admin.
| Field | Description |
|---|---|
| Bot API Token | The token from @BotFather (e.g., 123456:ABC-DEF...) |
| Bot Username | Your bot's username, starting with @ (e.g., @YourBot) |
| Channel Username | The target channel or group username, starting with @ (e.g., @your_channel) |
| Channel Signature | Optional text appended to every message (e.g., your brand name) |
| Parse Mode | Message formatting: HTML, Markdown, or MarkdownV2 |
Step-by-step
- Go to OwlStack > Telegram in your WordPress admin
- Paste your Bot API Token from @BotFather
- Enter the Bot Username (e.g.,
@MyOwlBot) - Enter the Channel Username (e.g.,
@my_channel) - Optionally set a Channel Signature to brand your messages
- Choose a Parse Mode (defaults to
HTML) - Click Save Settings
Testing
After saving your settings, use the built-in testing tools:
- Click Test Connection to verify your bot token is valid and the channel is reachable
- Click Send Test Message to publish a sample message to your channel
- Check your Telegram channel to confirm the message arrived
Publishing
Once configured, Telegram appears as a toggle in the OwlStack meta box on post edit screens.
Auto-publish
When auto-publish is enabled, new posts are automatically sent to Telegram when they transition to publish status.
Manual publish
Use the Publish Now button in the OwlStack meta box to send a post to Telegram on demand.
Programmatic publishing
// Simple text message
owlstack()->telegram('Hello from WordPress!');
// With an image attachment
owlstack()->telegram('Check out this photo!', [
'type' => 'photo',
'url' => 'https://example.com/image.jpg',
]);
// With inline keyboard buttons
owlstack()->telegram('Visit our site', null, [
[['text' => 'Open Website', 'url' => 'https://example.com']],
]);
// Override the target channel
owlstack()->telegram('Hello!', null, null, [
'chat_id' => '@another_channel',
]);Constraints
| Constraint | Value |
|---|---|
| Max text length | 4,096 characters |
| Max caption length | 1,024 characters |
| Max media per group | 10 |
| Supported media types | JPEG, PNG, GIF, MP4, OGG |
| Supported parse modes | HTML, Markdown, MarkdownV2 |
Troubleshooting
| Issue | Solution |
|---|---|
| "Unauthorized" error | Verify your Bot API Token is correct |
| "Chat not found" | Ensure the bot is an admin of the channel/group |
| Messages not appearing | Check the Channel Username starts with @ |
| Formatting broken | Switch Parse Mode to HTML for most reliable results |