Auto-posting Articles from a Website to Telegram and VK
TL;DR
My task was: articles from a Joomla website should be automatically published to Telegram, and then to other social networks. I did this not via cron and RSS polling, but via a Joomla plugin that fires at the moment an article is published. The post goes to the social network the very same second.
Technology Stack
| Technology | Role |
|---|---|
| Joomla | CMS, source of articles and events |
| PHP | Plugin and formatter |
| Telegram Bot API | Publishing with HTML markup |
| VK API | Publishing with emoji structure |
| OK API | Publishing (waiting for GROUP_CONTENT permission) |
Context and Task
The studio website runs on Joomla, and articles are published manually through the admin panel. Previously, after each publication, I had to manually duplicate the article to the Telegram channel: copy the text, clean up the markup, insert links. I wanted this to happen automatically — and with an eye to the future: VK next, then other platforms.
The first option was to set up n8n or another orchestrator. But for a single "website → Telegram" integration, that's extra infrastructure: a separate service, Docker, maintenance, updates. I needed a simpler and cheaper solution.
Key Decision: Trigger Instead of Polling
Initially, the assistant suggested the classic approach: a Python script that polls the Joomla RSS feed via cron every 10–15 minutes and picks up new articles. That works, but I asked a clarifying question: since articles are published manually, wouldn't it be simpler to use the publication itself as the trigger?
That turned out to be the right move. When an article is published through the Joomla admin panel, you can attach a handler directly to the publication event — and the post will be published to Telegram instantly, without delays and without a "what's already been published" file.
Technically, this is a System plugin for Joomla that subscribes to the onContentAfterSave event, checks that the article has just been published, and makes the request to the Telegram Bot API itself.
Why event is better than cron in this scenario
Cron with RSS polling is needed when you don't have access "from inside" the system. I did have access — the site runs on Joomla, and publication goes through the admin panel. So you can hook into the very moment of publication: fewer moving parts, no delays, no state file for "what's already been posted."
How It Works
Telegram: Markup Is Not an Orchestrator
One important thing became clear: post markup in Telegram is not a reason to set up an orchestrator. It's just the parse_mode parameter in the sendMessage request (values HTML or MarkdownV2). It works the same way from PHP, Python, or n8n.
The only real challenge is conversion. In Joomla, content is stored as HTML, while Telegram only understands a limited subset of tags. So in the plugin, the article text is run through a formatter that:
- keeps only allowed tags (
b,i,a,code,pre); - converts lists into plain text;
- removes everything else that Telegram won't understand.
I chose parse_mode=HTML — it requires less escaping than MarkdownV2.
Architecture: Modules for Each Social Network
From the start, I built in modularity: there's a common "publisher" interface, and a separate module for each platform. Adding a new social network means adding one file, not reworking the whole system.
├── Joomla plugin (entry point, catches the publication event)
├── formatter (article HTML → platform markup)
├── publishers/
│ ├── telegram_publisher
│ ├── vk_publisher
│ └── (ok_publisher — in progress)
VK: Emoji Instead of Bold
With VK, I discovered a quirk: wall posts do not support true bold text. Visual structure in live posts is achieved with emoji markers before subheadings and list items, not with tags.
At first, this looked like "markup can't be done," but in practice, the structure can be reproduced automatically: an emoji marker is placed before each subheading. This isn't "smart" emoji selection based on meaning (that would require AI rewriting), but a predictable structure — and that's enough to keep the post from looking like a solid block of text.
Problems I Encountered
1. The "VK Community ID" Field Erased Text Addresses
In the plugin settings, the field only accepted digits, so a text-based short community name would get erased. I needed the numeric community ID, not the short name from the URL.
The solution was to get the numeric ID via the API:
https://api.vk.com/method/groups.getById?group_id=SHORT_NAME&access_token=TOKEN&v=5.199
The response contains JSON with an id field — that's the number I needed. That's what goes into the field.
2. Odnoklassniki Is More Complex Than VK
When I got to OK, it turned out to be noticeably more complex: they have their own request signing scheme (not just a token, but also an MD5 signature for every call) and a mandatory manual approval of the GROUP_CONTENT permission from tech support. This isn't a five-minute setup, but a process that takes a couple of days: a developer rights request, creating an app, emailing support, and waiting.
I prepared everything I could: got the app keys, token, and group GID. The module itself will be written using the same architecture once the GROUP_CONTENT permission is approved.
Final Diagram
flowchart LR
A["Article published<br>in Joomla"] --> B["onContentAfterSave event"]
B --> C["Plugin: formatter"]
C --> D["Telegram publisher"]
C --> E["VK publisher"]
C --> F["OK publisher<br>(in progress)"]
Result
An article published on the website goes to Telegram the very same second — with a bold headline, links, and correct markup. To VK — with structure via emoji. No manual text copying or reformatting.
No cron, no separate orchestration service, no "what's already been posted" file. Just one PHP plugin embedded in the very moment of publication.
What I Learned
- Think about the trigger first. The publication event is simpler and more reliable than cron with RSS polling.
- Markup is a parameter, not a reason for an orchestrator.
parse_modesolves the problem, not n8n. - Modularity pays off. One "publisher" interface — and a new social network is added as a separate file.
- Each platform has its own quirks. VK doesn't support bold in wall posts, OK requires manual permission approval — these need to be discovered early, not at the final step.
What's Next
Once GROUP_CONTENT approval comes from Odnoklassniki, I'll add the ok_publisher module. Next on the list: AI-based emoji selection by meaning (a separate logical component), and possibly automatic cover image generation for posts.
