The moment it happens
Turn a PDF sent to Telegram into a blog post you approve
Send a PDF to your bot and it becomes a WordPress draft; tap Approve in Telegram and the post goes live.
- Runs
- The moment it happens
- Apps
- Telegram, WordPress
- AI
- Yes, uses the built-in AI allowance
- Access
- WordPress author+; bot token
Send this to your assistant
Create a ClickRuntime automation: when I send a PDF to my Telegram bot, turn it into a blog post with AI, save it as a WordPress draft, and publish it when I tap Approve.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
A consultancy produces research reports, case studies and slide decks as PDFs. Each one could become a useful blog post, but turning a twenty-page report into a readable article is a job nobody gets to, so good material stays buried in email attachments.
With this automation, a consultant sends the PDF to the company's Telegram bot. AI writes a blog post from the document, it is saved as a WordPress draft, and the bot replies with a preview link and an Approve button. One tap publishes it; ignoring it leaves the draft for editing.
What you get out of it
Reports become readable posts
Long documents are rewritten as articles people will actually read online. Work you have already done reaches a much wider audience.
Approval in one tap
The Approve button publishes the post straight from Telegram. There is no need to log in to WordPress if the draft is ready as it is.
Nothing goes live by accident
Posts stay as drafts until someone taps Approve. You can also edit the draft in WordPress first and approve afterwards.
Send from anywhere
A PDF in your email or files can be forwarded to the bot from your phone in seconds.
How it works
What happens, step by step
When you send a PDF to your Telegram bot, ClickRuntime downloads it and reads the text.
AI writes a blog post from the document with a title, excerpt and headings.
The post is saved as a draft in WordPress, and the bot replies with a preview link and an Approve button.
When you tap Approve, the draft is published and the bot confirms with the live link.
Before it runs live
- Connect Telegram
- Connect WordPress
- Paste your automation's link into the other app's webhook settings
What you get
Build your own
Need it to work differently?
Your own rules
Conditions, thresholds, filters and exceptions, written the way you'd explain them to a colleague.
Any number of apps
One automation can read from one app and update several others. Over 248 apps are ready, and anything with an API works too.
AI where it helps
Summaries, classification, extraction and drafts use ClickRuntime's built-in AI, with no extra key.
On a schedule or on each event
Runs as often as every 5 minutes, or the moment an app sends an event, and keeps track of what it already handled.
Changes you can ask for
- Act only on the items that match your own rules, and skip the rest
- Change what the AI looks for, or how it writes the result
- Add another app, for example also send it to Slack
- Combine it with other Telegram and WordPress steps into one automation
Under the hood
The code that runs this automation
import io
from pypdf import PdfReader
from clickruntime import on_event, credentials, http, ai
APPROVERS = {123456789}
SCHEMA = {"type": "object", "properties": {k: {"type": "string"} for k in ["title", "excerpt", "body_html"]}, "required": ["title", "excerpt", "body_html"]}
WP = "https://blog.example.com/wp-json/wp/v2"
def wp(method, path, **kw):
r = http.request(method, f"{WP}/{path}", auth=(credentials.secret("WP_USER"), credentials.secret("WP_APP_PASSWORD")), **kw)
r.raise_for_status()
return r.json()
def telegram(method, **payload):
return http.post(f"https://api.telegram.org/bot{credentials.secret('TELEGRAM_BOT_TOKEN')}/{method}", json=payload).json()
@on_event
def handle(event):
update = event.json or {}
if cb := update.get("callback_query"):
if cb["from"]["id"] in APPROVERS and cb["data"].startswith("approve:"):
post = wp("POST", f"posts/{cb['data'].split(':')[1]}", json={"status": "publish"})
telegram("sendMessage", chat_id=cb["message"]["chat"]["id"], text=f"Published: {post['link']}")
return {"callback": True}
msg = update.get("message") or {}
if not msg.get("document") or msg["from"]["id"] not in APPROVERS:
return {"ignored": True}
path = telegram("getFile", file_id=msg["document"]["file_id"])["result"]["file_path"]
pdf = http.get(f"https://api.telegram.org/file/bot{credentials.secret('TELEGRAM_BOT_TOKEN')}/{path}").content
text = " ".join(p.extract_text() or "" for p in PdfReader(io.BytesIO(pdf)).pages)[:20000]
art = ai.generate(f"Turn this document into a 900-word blog post with H2 headings (HTML body):\n{text}", json_schema=SCHEMA, max_output_tokens=2048).json
post = wp("POST", "posts", json={"title": art["title"], "excerpt": art["excerpt"], "content": art["body_html"], "status": "draft"})
telegram("sendMessage", chat_id=msg["chat"]["id"], text=f"Draft ready: {art['title']}\n{post['link']}&preview=true",
reply_markup={"inline_keyboard": [[{"text": "Approve", "callback_data": f"approve:{post['id']}"}]]})
return {"draft": post["id"]}FAQ
Common questions
What kind of PDFs work?
Who can approve posts?
Can I edit the draft before approving?
What permissions does it need?
Does it need AI?
How many runs does it use?
Can I change how it works?
Related
You might also like
Send a link to Telegram and get a WordPress draft
Share a product page, article or forum thread with your bot and a WordPress draft based on it is created, with the edit link sent back to you.
See how it worksPublish a weekly SEO blog post and get the link on Telegram
Every week the next keyword on your list becomes a blog post on your WordPress site, and Telegram sends you the link as soon as it is up.
See how it worksRewrite new feed articles for your site and share them on Telegram
New articles from the feeds you follow are rewritten as posts on your WordPress site and shared on your Telegram channel with the link.
See how it worksKeep exploring
Set up “Turn a PDF sent to Telegram into a blog post you approve” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.