Rockon Post Notifications for Telegram

Description

Rockon Post Notifications for Telegram connects your WordPress site to a Telegram bot and posts an
announcement to your channel whenever you publish a new post. Set it up once with a bot token
and a channel name, write the message you want, and every post goes out automatically.

This plugin is an independent integration. It is not affiliated with, endorsed by, sponsored by
or otherwise associated with Telegram. Telegram is a trademark of Telegram Messenger Inc., used
here only to describe what this plugin connects to.

Free features

  • Telegram bot connection, verified from the settings page
  • Delivery to any Telegram channel or group
  • Automatic notification when a new post is published
  • Custom message template with post title, link, excerpt, author, date, categories and tags
  • Send a test message with one click
  • Enable or disable notifications at any time
  • Plain text or HTML formatting, silent delivery and link preview control

Pro features

Rockon Post Notifications for Telegram Pro adds closing tomorrow reminders, last date today alerts,
weekly summaries, scheduled notifications, multiple channels, category based notifications,
advanced message templates, custom fields, notification logs, retries for failed notifications,
Telegram inline buttons, image support and advanced rules.

External services

This plugin connects to one external service, the Telegram Bot API. Sending your notifications to
Telegram is the core purpose of the plugin, and this is how it does it.

It is used when you press Check Connection (which asks Telegram to identify your bot), when
you press Send Test Message, and whenever a post is published while notifications are
enabled.

The data sent is your bot token, the channel or chat ID you entered, and the message built from
your template — which typically includes the post title, link, excerpt, author, date, categories
and tags. Nothing is sent until you have entered a bot token and a chat ID of your own, and
nothing is sent on publish unless you tick the notification setting.

This service is provided by Telegram — terms of service: https://telegram.org/tos —
privacy policy: https://telegram.org/privacy

Screenshots

Installation

The whole setup takes about five minutes. You need a Telegram account and a channel (or group) you administer. Everything below is also available inside the plugin under Rockon Notifications > Setup Guide.

Step 1: install and activate

  1. Upload the rockon-post-notifications-telegram folder to /wp-content/plugins/, or install the plugin from Plugins > Add New in your WordPress admin.
  2. Activate it.
  3. A new Rockon Notifications menu appears in the admin sidebar. Open Rockon Notifications > Settings.

Step 2: create a Telegram bot and copy the token

The plugin posts to Telegram through a bot that belongs to you. Creating one is free and takes a minute:

  1. Open Telegram (phone or desktop) and search for @BotFather – the official account with the blue verified tick. Or open https://t.me/BotFather in a browser.
  2. Press Start, then send the command /newbot.
  3. BotFather asks for a name. This is the display name shown next to your messages, for example My Site News. Spaces are allowed.
  4. BotFather then asks for a username. It must be unique across Telegram and must end in bot, for example mysitenews_bot. If the name is taken, try another one.
  5. BotFather replies with a message containing your token. It looks like this:

    123456789:AAHdqTcvCH1vGWJxfSeofSAs0K5PALDsaw

    The part before the colon is the bot ID, the part after it is the secret.

  6. Copy the whole token, including the digits and the colon.

Keep the token private. Anyone who has it can post as your bot. If it ever leaks, send /revoke to BotFather to generate a new one, then paste the new token into the plugin.

Step 3: paste the token into WordPress

  1. In Rockon Notifications > Settings, paste the token into the Bot token field.
  2. Press Check Connection. The plugin asks Telegram who the bot is and replies with Connected to @yourbot when the token is valid. Unauthorized means the token was copied incorrectly or has been revoked.

Step 4: let the bot post in your channel

A brand new bot cannot post anywhere until you invite it. Pick the option that matches you:

Public channel (it has a t.me/name link)

  1. Open your channel in Telegram.
  2. Tap the channel name > Administrators > Add Administrator.
  3. Search for your bot by its username (for example mysitenews_bot) and select it.
  4. Leave the Post Messages permission enabled and save.
  5. Your channel address is @yourchannelname.

Private channel (invite link only, no public username)

  1. Add the bot as an administrator exactly as above.
  2. Get the numeric chat ID. The quickest way: forward any message from the channel to @userinfobot, which replies with the ID. It starts with -100, for example -1001234567890.

Group (instead of a channel)

  1. Open the group > Add members and add your bot.
  2. Promote it to administrator so it can post reliably.
  3. Get the group ID the same way, by forwarding a group message to @userinfobot. Group IDs are negative numbers too.

Step 5: enter the channel and test

  1. Put @yourchannelname (public) or the numeric ID such as -1001234567890 (private channel or group) into the Channel / Chat ID field. Pasting a full https://t.me/yourchannel link also works, the plugin converts it for you.
  2. Tick Send a Telegram message when a post is published.
  3. Press Save Settings.
  4. Press Send Test Message. A message should arrive in your channel within a second or two. If it does not, the exact reason Telegram gave is shown next to the button.

Step 6: write your message

Edit the Message template to say whatever you like and click the tags below it to insert post data. For example:

<b>{post_title}</b>
{post_excerpt}
Read more: {post_url}

Choose HTML formatting for bold, italic and links, or Plain text if you prefer no formatting. Publish a post and the message goes out automatically.

FAQ

Where exactly do I get the bot token?

From @BotFather inside Telegram. Send /newbot, choose a name and a username ending in bot,
and BotFather replies with a token in the form 123456789:AAHdqTcvCH1vGWJxfSeofSAs0K5PALDsaw.
Full walkthrough in the Installation tab above.

I lost my token. Where can I see it again?

Send /mybots to @BotFather, pick your bot, then choose API Token. You can also send
/token and select the bot. If you would rather invalidate the old one, use /revoke.

How do I find the chat ID of a private channel or group?

Forward any message from that channel or group to @userinfobot and it replies with the ID.
Alternatives are @RawDataBot or @getidsbot, added to the chat for a moment and then removed.
Private channel IDs start with -100, for example -1001234567890. Enter the minus sign too.

Do I have to make the bot an administrator?

Yes, for channels. Telegram only lets administrators post in a channel, so add the bot under
Administrators with the Post Messages permission. In groups, an ordinary member can often
post, but promoting the bot avoids problems with privacy mode and group settings.

Can I send to a group instead of a channel?

Yes. Add the bot to the group, promote it, and use the group’s numeric ID in the
Channel / Chat ID field.

Can I use one bot for several websites?

Yes. The same token can be used on any number of sites, and each site can point at a different
channel. Every site posts under the same bot name.

Is my token stored safely?

It is stored in your WordPress options table and is only readable by users who can manage
options, that is administrators. It is never sent anywhere except to Telegram’s own API over
HTTPS. On a shared or untrusted site, create a dedicated bot for that site so a leak affects
nothing else.

Nothing is sent when I publish. What should I check?

In order: notifications are ticked and saved; Check Connection returns your bot name;
Send Test Message succeeds; the bot is an administrator of the channel; the chat ID includes
the leading @ or the leading minus sign. Whenever a delivery fails, the reason from Telegram is
shown in the Status box on the settings page.

What does «chat not found» mean?

Telegram cannot see the channel you named. Usually the username is misspelled, the numeric ID is
missing its -100 prefix, or the bot was never added to the channel.

Does it notify when I update an old post?

No. A message goes out the first time a post moves into the published status and never again.
Each post is marked as notified so it cannot be announced twice.

Do scheduled posts work?

Yes. When WordPress publishes a scheduled post, the notification is sent at that moment, provided
WP-Cron is running on your site.

Which post types are supported?

Posts. Other post types, category rules, multiple channels and scheduled reminders are part of Pro.

In which language are the messages sent?

Whatever you type in the message template. The post title, excerpt and other tags come from the
post itself, so a site in any language works as it is.

Reviews

There are no reviews for this plugin.

Contributors & Developers

“Rockon Post Notifications for Telegram” is open source software. The following people have contributed to this plugin.

Contributors

Changelog

1.0.0

  • First release.