Telegram ChatGPT Poster - AI-driven autoposting
The channel fills itself: AI writes the posts, the bot keeps them readable
A bot that writes posts through ChatGPT and publishes them to a Telegram channel, splitting the model's long answer into readable messages that stay inside the messenger's limits.
Before
The channel needs regular posts. An AI model answers in one long block that hits Telegram's message limit and gets cut off, and whatever fits reads as a solid wall of text.
What I built
A bot writes posts with ChatGPT and publishes them to the channel right away or on a schedule, splitting long text into messages by paragraph and pausing between sends. Length, pauses and keys change in the settings.
After
The channel fills with nobody in the loop: generation and publishing run as one chain. Long texts no longer get cut off or turn into a wall of text, and the format is tuned to the channel through settings.
What the client got
-
AI-written posts
The bot gets the text from ChatGPT and can add an image to the post; length and creative freedom are set in the settings.
-
Posting now or on a schedule
A finished post goes to the channel right away or at a set time.
-
Split by paragraph
A long answer is cut into messages on paragraph boundaries, never mid-word.
-
A pause between messages
A series of messages does not go out in one volley; the pause is adjustable.
-
Settings, not code
Text length, pauses, splitting and keys change in the settings window, without editing the bot.
-
A subscription shop bot
Subscriptions to the bot are sold by a separate shop bot in Telegram.
How it was built: details and stack
Tech Stack
Overview
A small but durable tool: a bot that writes posts through ChatGPT and publishes them to a Telegram channel. The brief was a single line - “build AI-driven autoposting” - and all of the substantive work turned out to sit not in generation but in reconciling two formats: how a language model answers, and how messages work in Telegram.
Problem
The model returns text as one block of arbitrary length. Telegram is a messenger with a hard per-message limit and its own typography, where a wall of text goes unread. Publishing the answer as-is produces two failures at once: a long answer hits the limit and gets truncated, and one that fits reads as an unbroken slab.
Plus two operational questions that always surface in week two: where to keep the API keys so they can be swapped without editing the script, and how to avoid firing messages back to back with no pause.
Solution
The bot receives Telegram updates on its own HTTP server (the port is configurable), generates text through the OpenAI API, and publishes the result to the channel.
The key parameters live in the resources dialog and change without touching the logic: MaxTokens and MaxTemperature control the length and temperature of the text, the delay between messages in milliseconds spaces the sends out, and the paragraph-split multiple decides how many paragraphs go into one message. That last parameter is what solves the original problem: a long model answer becomes a series of readable messages cut on paragraph boundaries rather than by a character counter in the middle of a word.
OpenAI keys are read from a separate file instead of living inside the script, so they can be replaced without rebuilding the bot.
Features
- Post generation through the OpenAI API with configurable
MaxTokensandtemperature - Publishing to a Telegram channel via its own webhook server on a configurable port
- Long answers split into messages by paragraph groups - on meaning boundaries, not on a character count
- Configurable pause between message sends
- OpenAI keys kept in a separate file, swappable without editing the script
- All parameters supplied through the resources dialog at launch
Development Process
The task arrived as a one-line brief, and the first version did exactly what was asked: ask the model, send the answer. It fell over on the first long text.
From there the work came down to describing Telegram’s format in parameters rather than hard-coding it. Splitting by paragraph groups instead of by characters is the only way not to tear text mid-thought. The pause between messages exists so a series of posts does not go out in one volley. Both values sit in settings, because the “right” split depends on the channel and on the kind of texts it publishes, and gets tuned in practice.
Results
- The channel fills without a person in the loop: generation and publishing run as one chain
- Long model answers no longer hit the message limit or arrive as a wall of text
- The publishing format is tuned to the channel through parameters, not code edits
- Keys and tokens are separated from the logic and change in the resources dialog
What Was Learned
A small case, but a telling one: the real work in “build ChatGPT autoposting” is not on the ChatGPT side. Generating text is one API call. Making that text look like a proper post in one specific channel is splitting, pauses, limits and parameters tuned against real publications.
The same boundary between “the model answered” and “the product works” shows up in a larger project in this portfolio - Astrogenerator, where fitting the text to Telegram’s format and the client’s taste took two of the six weeks.
Services used in this project
Related case studies
- Astrogenerator - Horoscope Generation Telegram BotA tripwire bot for a practicing astrologer: it writes the daily and the personal horoscope with ChatGPT, draws the lunar-day card itself, and warms subscribers up for one-to-one work.
- Neurox - AI Photo and Video Generation Bot for VKA bot for a VK community that turns text and photos into images and video: 12 AI models in one chat, payments through YooKassa and an owner's panel with the revenue, cost and margin of every generation.