AI Dev Content Generator for Telegram
Build a CLI tool that generates and posts AI dev content to Telegram.
Introduction
30 Second Summary
Running a developer content channel is one of the best ways to build your personal brand. But coming up with polished posts every single day is exhausting.
In this project, you will build a command-line tool that takes any dev topic, uses AI to generate a formatted post, and publishes it directly to your Telegram channel. It also prints a LinkedIn-ready version to your terminal for easy copy-paste.
What You'll Build
You run a single command with a topic like "async/await in JavaScript", and within seconds a beautifully formatted post lands on your Telegram channel while a LinkedIn-ready version appears in your terminal.
By the end of this project, you'll have:
- A CLI tool that turns any dev topic into a polished post auto-published to your Telegram channel in seconds.
- A separate LinkedIn-ready version with attention-grabbing hooks, bullet points, and hashtags printed to your terminal for easy copy-paste.
- Posts that arrive on your channel with proper formatting including bold headings, bullet points, and clean structure.
- Secret Mission: Add multiple content styles so you can vary your posts between quick tips, deep dives, and threads.
Are there any prerequisites?
You should have basic JavaScript knowledge and Node.js installed on your machine. You also need a Telegram channel that you own or administer.
No paid accounts are required. The Gemini API free tier and the Telegram Bot API are both completely free to use.
Before We Start
Before We Start...
Before we dive in, let's lock in what you're about to build and why it matters. This step is your moment to commit to the goal before any hands-on work begins.
Set Up Your Project
Your AI content generator needs three pieces before it can do anything useful: a Node.js project with the right packages installed, a free Gemini API key to generate content, and a Telegram bot that can post to your channel.
In this step, you will scaffold the project, grab both API credentials, and wire them into a starter script that validates everything is connected.
In this step, get ready to:
- Create a Node.js project with ES module support and install the Gemini SDK.
- Get a free Gemini API key and create a Telegram bot.
- Connect your bot to your channel and verify the setup runs.
Create your project folder and install dependencies
- Press Cmd+Space (macOS) or the Windows key (Windows) to open your search bar.
- Type VS Code and press Enter to open it.
- Open the integrated terminal by pressing Ctrl+` (macOS and Windows).
- Move to your Desktop by running this command:
cd ~/Desktop
- Create your project folder and move into it by running these commands:
mkdir dev-content-generator
cd dev-content-generator
- Initialize a new Node.js project by running:
npm init -y
You should see output confirming a package.json file was created in your folder.
- Open the dev-content-generator folder in VS Code by clicking File in the top menu bar.
- Click Open Folder.
- Select the dev-content-generator folder on your Desktop, then click Open.
Why open the folder this way?
Opening the folder through File > Open Folder tells VS Code to treat dev-content-generator as your workspace root. The Explorer sidebar shows your project files and the terminal opens inside the correct directory.
Your terminal should now show you are inside the dev-content-generator folder. If it does not, reopen the terminal with Ctrl+`.
- Open package.json from the Explorer sidebar on the left.
- Replace its entire contents with the following:
{
"name": "dev-content-generator",
"version": "1.0.0",
"type": "module",
"description": "AI-powered dev content generator for Telegram",
"main": "index.js",
"scripts": {
"start": "node index.js"
},
"keywords": [],
"author": "",
"license": "ISC"
}
What does this code do?
The key change from the default is "type": "module". This tells Node.js to use ES modules (the import/export syntax) instead of the older require() style. The Gemini SDK uses ES module imports, so this is required.
- Save package.json.
- Install the project dependencies by running this command in your terminal:
npm install @google/genai dotenv
You should see output showing packages were added. Your terminal will print something like added 2 packages.
What are these packages?
- @google/genai is Google's official SDK for the Gemini AI API. It lets you send prompts and get AI-generated text back.
- dotenv loads values from a .env file into process.env so you can keep secrets out of your code.
- Confirm the install worked by running:
ls
You should see node_modules, package.json, and package-lock.json listed in the output.
Not seeing node_modules?
- Make sure your terminal is inside the dev-content-generator folder. Run pwd to check your current directory.
- If you see an error about package.json not found, you may have run npm install from the wrong folder.
Why isn't npm install working in my project?
Get your Gemini API key and Telegram bot token
You need two credentials: a Gemini API key to generate content and a Telegram bot token to publish it.
- Open your browser and go to aistudio.google.com.
- Sign in with your Google account if prompted.
- Click Get API key in the left sidebar.
- Click Create API key.
What happens when I click Create API key?
If you are a new user, Google AI Studio automatically creates a default Google Cloud project and generates an API key tied to it. No credit card is required. The Gemini API free tier provides free input and output tokens.
If you already have Google Cloud projects, you may need to select one from the dropdown or import it first.
- Copy the generated API key and save it somewhere safe (you will paste it into your project shortly).
Can't create an API key?
If you already have Google Cloud projects but they are not visible, you need to import them. Open the Dashboard from the left panel, select Projects, then click Import projects.
Help me get my Gemini API key from Google AI Studio
Now you need a Telegram bot token. You will get this from @BotFather, Telegram's official bot for creating and managing bots.
- Open Telegram on your phone or desktop.
- Search for @BotFather and open the chat.
- Send the message /newbot.
What will BotFather ask you?
BotFather will ask for two things. First, a display name for your bot (this can be anything, like "Dev Content Bot"). Second, a username that must end in bot (like mydevcontent_bot).
The username must be unique across all of Telegram, 5-32 characters, and can only contain Latin letters, numbers, and underscores. It cannot be changed later, so choose carefully.
- Enter a display name when BotFather asks (for example, Dev Content Bot).
- Enter a username ending in bot when prompted (for example, mydevcontent_bot).
- Copy the bot token that BotFather sends back. It looks like a long string of numbers, a colon, then random characters.
You now have both credentials. Time to store them in your project.
- Back in VS Code, create a new file called .env in the root of your dev-content-generator folder.
- Add the following two lines, replacing the placeholder values with the real keys you just copied:
GEMINI_API_KEY=your-api-key-here
TELEGRAM_BOT_TOKEN=your-bot-token-here
What is a .env file?
A .env file stores environment variables that your code reads at runtime. This keeps sensitive credentials out of your source code. The dotenv package loads these values into process.env automatically when your script starts.
- Save .env.
- Confirm it exists by running:
ls -a
You should see .env listed among your files (the -a flag shows hidden files that start with a dot).
Connect your bot to your channel and create the entry point
Your bot exists, but it cannot post to your channel yet. Telegram requires the bot to be added as a channel administrator before it can send messages there.
- In Telegram, open your channel.
- Tap or click the channel name at the top to open its settings.
- Select Administrators.
- Tap Add Administrator.
- Search for the bot username you just created and select it.
- Make sure Post Messages is enabled, then save.
Now you will create the project's entry point and test that your validation logic works.
- In VS Code, create a new file called index.js in the root of your project.
- Add the following code:
import "dotenv/config";
// Store Telegram credentials from environment variables
const TELEGRAM_BOT_TOKEN = process.env.TELEGRAM_BOT_TOKEN;
const TELEGRAM_CHANNEL_ID = process.env.TELEGRAM_CHANNEL_ID;
// Exit early if any required key is missing
if (!process.env.GEMINI_API_KEY || !TELEGRAM_BOT_TOKEN || !TELEGRAM_CHANNEL_ID) {
console.error("Missing API keys. Check your .env file has GEMINI_API_KEY, TELEGRAM_BOT_TOKEN, and TELEGRAM_CHANNEL_ID.");
process.exit(1);
}
What does this code do?
- import "dotenv/config" automatically reads your .env file and loads its values into process.env.
- The if block checks that all three required environment variables are present. If any one is missing or empty, the script prints a helpful error message and stops immediately.
- This validation catches configuration mistakes up front instead of letting the tool crash later with a confusing error.
- Save index.js.
Before you run this, think about what you expect to happen. Your .env file has GEMINI_API_KEY and TELEGRAM_BOT_TOKEN, but does it have TELEGRAM_CHANNEL_ID? What do you think the script will do?
- Test the validation by running:
node index.js "test"
You should see this error printed to your terminal:
Missing API keys. Check your .env file has GEMINI_API_KEY, TELEGRAM_BOT_TOKEN, and TELEGRAM_CHANNEL_ID.
This is exactly what you want. The validation caught that TELEGRAM_CHANNEL_ID is missing from your .env file.
- Open .env and add a third line with your Telegram channel username (the @ prefix is required):
GEMINI_API_KEY=your-api-key-here
TELEGRAM_BOT_TOKEN=your-bot-token-here
TELEGRAM_CHANNEL_ID=@yourchannelusername
Find your channel username
Your channel username is the @name shown in the channel info. If your channel is private (no public username), you can use the channel's numeric ID instead. You can find it by forwarding a channel message to @userinfobot.
- Save .env.
- Run the script again:
node index.js "test"
This time the script exits cleanly with no output and no error. All three environment variables are present, so the validation passes.
Still seeing the Missing API keys error?
- Check that .env has no spaces around the = signs. It should be TELEGRAM_CHANNEL_ID=@yourname with no spaces.
- Make sure your .env file is in the same folder as index.js (the project root).
- Confirm you spelled the variable names exactly: GEMINI_API_KEY, TELEGRAM_BOT_TOKEN, TELEGRAM_CHANNEL_ID.
Help me fix the Missing API keys error in my .env setup
✔️ Awesome, I've got everything!
Great. Double check you have saved both .env and index.js.
ⓧ I'd like to double check the full code
Here is what your index.js should look like:
import "dotenv/config";
const TELEGRAM_BOT_TOKEN = process.env.TELEGRAM_BOT_TOKEN;
const TELEGRAM_CHANNEL_ID = process.env.TELEGRAM_CHANNEL_ID;
if (!process.env.GEMINI_API_KEY || !TELEGRAM_BOT_TOKEN || !TELEGRAM_CHANNEL_ID) {
console.error("Missing API keys. Check your .env file has GEMINI_API_KEY, TELEGRAM_BOT_TOKEN, and TELEGRAM_CHANNEL_ID.");
process.exit(1);
}
And your .env should have three lines (with your real values instead of placeholders):
GEMINI_API_KEY=your-api-key-here
TELEGRAM_BOT_TOKEN=your-bot-token-here
TELEGRAM_CHANNEL_ID=@yourchannelusername
Your project foundation is solid. You have a Node.js project with the Gemini SDK installed, all three API credentials wired up, and a validation check that catches missing configuration. Next up, you will use the Gemini API to generate your first AI-powered dev post.
Generate Your First AI Post
Your project is scaffolded and your API keys are ready. Now it's time to make this tool actually do something useful.
The core value of this tool is AI-generated content. In this step, you'll connect to the Gemini API and get it to produce a developer-focused post from a single topic you type in your terminal.
In this step, get ready to:
- Build a function that sends a prompt to Gemini and gets a dev post back.
- Wire up your CLI so you can pass any topic as an argument.
- Run the tool and see your first AI-generated post printed in the terminal.
Build the generatePost function
Your index.js currently loads environment variables and checks they exist. Now you need to import the Gemini SDK, initialize a client, and write a function that sends a prompt to the AI.
- In index.js, find the line import "dotenv/config"; at the top of your file.
- Add this import directly below it:
import { GoogleGenAI } from "@google/genai";
- Next, add the AI client initialization on a new line directly above const TELEGRAM_BOT_TOKEN:
const ai = new GoogleGenAI({ apiKey: process.env.GEMINI_API_KEY });
- Now scroll to the bottom of your file, after the closing } of the if block. Add the generatePost function by pasting this code below:
async function generatePost(topic) {
// Build a prompt that tells the AI what kind of content to produce
const prompt = `You are a developer content creator. Write an engaging post about "${topic}" for developers.`;
// Send the prompt to Gemini and wait for a response
const interaction = await ai.interactions.create({
model: "gemini-3.5-flash",
input: prompt,
});
return interaction.output_text;
}
What does this code do?
- GoogleGenAI is the SDK class that handles authentication and communication with Google's AI models.
- ai.interactions.create() sends your prompt to the gemini-3.5-flash model and returns a response object.
- interaction.output_text extracts just the text content from the AI's response.
- Save index.js.
Wire up the CLI to capture your topic
The generatePost function is ready, but nothing calls it yet. You need a main() function that grabs the topic from the command line and passes it in.
- At the bottom of index.js, directly after the generatePost function, add the main function and its call:
async function main() {
// Grab the topic from the command line arguments
const topic = process.argv[2];
if (!topic) {
console.log('Usage: node index.js "your topic"');
process.exit(1);
}
// Generate the post and print it
const response = await generatePost(topic);
console.log(response);
}
main();
What does this code do?
- process.argv[2] reads the first argument you pass after node index.js in your terminal. That's your topic.
- If no topic is provided, the script prints a usage hint and exits so you don't accidentally send an empty prompt to the API.
- The main(); call at the bottom kicks everything off when you run the file.
- Save index.js.
✔️ Awesome, I've got everything!
Great. Make sure you've saved your file before moving on.
ⓧ I'd like to double check the full code
Your index.js should have these sections in order. Scroll through your file and confirm each one is present:
- Two imports at the top: dotenv/config and GoogleGenAI.
- Three const declarations: ai, TELEGRAM_BOT_TOKEN, and TELEGRAM_CHANNEL_ID.
- The if block checking for missing API keys.
- The generatePost async function.
- The main async function, followed by main(); on the last line.
Run the tool and see your first AI-generated post
Everything is wired up. Before you run this, what do you expect to see printed in the terminal?
- Run your tool with a topic by running this command:
node index.js "async/await"
After a few seconds, you should see a full AI-generated developer post about async/await printed directly in your terminal. The content will be different every time you run it.
Not seeing any output?
- If you see "Missing API keys", double-check that your .env file has all three variables set with real values (not the placeholder text).
- If you see a module import error, confirm your package.json has "type": "module" set.
- If you see an API error about an invalid key, go back to aistudio.google.com and generate a fresh key. Copy it carefully into your .env file with no extra spaces.
- Help me debug my Gemini API call
You just turned a single topic into a full developer post using AI. Next up, you'll take that generated content and automatically publish it to your Telegram channel.
Post to Your Telegram Channel
In the last step, you got the Gemini AI generating dev posts and printing them to your terminal.
Content sitting in your terminal is useful for testing, but it does not reach your audience. The real automation happens when the AI-generated post goes directly to your Telegram channel without any copy-pasting. In this step, you will wire up the Telegram Bot API so your tool auto-publishes every generated post.
In this step, get ready to:
- Build a function that sends text to your Telegram channel via the Bot API.
- Wire the function into your main flow so posts auto-publish after generation.
- Confirm the post appears on your channel and notice the formatting gap.
Build the sendToTelegram function
The Telegram Bot API accepts simple HTTP POST requests. You send a JSON body with your channel ID and the message text, and Telegram delivers it to your channel.
- In index.js, add the following sendToTelegram function directly below your generatePost function:
async function sendToTelegram(text) {
// Build the Telegram Bot API endpoint URL
const url = `https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/sendMessage`;
// POST the message to your channel
const response = await fetch(url, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
chat_id: TELEGRAM_CHANNEL_ID,
text: text,
}),
});
// Parse the response and check for errors
const data = await response.json();
if (!data.ok) {
console.error("Telegram error:", data.description);
}
return data;
}
What does this code do?
- It constructs the Telegram Bot API URL using your bot token from the .env file.
- It sends a POST request with chat_id (your channel) and text (the AI-generated post) as a JSON body.
- It checks the ok field in the response. Telegram returns ok: true for success and ok: false with a description explaining the error when something goes wrong.
Wire sendToTelegram into main()
Your main() function currently prints the generated post to the console. You need to replace that with a call to sendToTelegram so the post goes to your channel instead.
- In index.js, scroll down to the main() function and find this line:
console.log(response);
- Replace that line with the following three lines:
console.log("Posting to Telegram...");
const result = await sendToTelegram(response);
console.log("Telegram response:", result);
- Save index.js.
What changed?
Instead of just printing the post locally, your tool now sends the generated text to Telegram and logs the full API response so you can confirm it worked.
Run the tool and check your channel
Before you run this, think about what you expect to see. Will the post on your Telegram channel look nicely formatted with headings and bullet points, or will it look like plain text?
- Run your tool with a topic by running this command:
node index.js "JavaScript closures"
- Check your terminal output. You should see Posting to Telegram... followed by a JSON response containing "ok":true.
- Open your Telegram channel and look at the new post.
The post is there, but it looks like a wall of plain text. There are no bold headings, no bullet points, no visual structure. That is because Telegram treats the message as plain text by default unless you explicitly tell it to parse formatting.
Why does the post look unformatted?
The Telegram Bot API supports HTML and Markdown formatting, but only when you include a parse_mode parameter in your request. Without it, every character is rendered as plain text. You will fix this in the next step.
Post not appearing on your channel?
- If you see a Telegram error: message in your terminal, check the description it prints. Common issues: your bot is not added as an admin to the channel, or TELEGRAM_CHANNEL_ID in .env does not match your channel's username (it needs the @ prefix).
- If the terminal shows "ok":true but you do not see the post, make sure you are looking at the correct channel. The bot posts to the channel specified in TELEGRAM_CHANNEL_ID.
- help me debug why my Telegram bot is not posting to my channel
✔️ Awesome, I've got everything!
Great. Double check you have saved index.js with both the sendToTelegram function and the updated main().
ⓧ I'd like to double check the full code
Scroll up through your index.js and confirm these sections are present, in order:
- Imports and constants at the top (dotenv/config, GoogleGenAI, the three environment variable reads, and the missing-keys check).
- The generatePost function that builds a prompt and calls ai.interactions.create.
- The new sendToTelegram function that POSTs to the Telegram API.
- The updated main() function that calls generatePost, then sendToTelegram, and logs the result.
- The main() call at the bottom.
Your tool now auto-publishes to Telegram, but the posts arrive as a wall of plain text. Next up, you will instruct the AI to produce structured formatting and generate a LinkedIn version alongside it.
Format Posts and Generate LinkedIn Version
Your Telegram post from the last step arrived successfully, but it looked like a wall of plain text. No bold headings, no bullet points, no visual structure at all.
The fix is two-fold. First, you need to tell the AI exactly how to format its output using HTML tags that Telegram understands. Second, you need to ask for a separate LinkedIn version so you can cross-post with one command.
In this step, get ready to:
- Rewrite the AI prompt to produce dual-format output with HTML for Telegram and a hook-style post for LinkedIn.
- Parse the AI response into separate Telegram and LinkedIn sections.
- Enable HTML formatting on your Telegram posts and print the LinkedIn version to your terminal.
Rewrite the prompt for dual-format output
The Telegram Bot API supports HTML formatting when you pass parse_mode: "HTML" in your request. Tags like <b> and <i> render as bold and italic directly in the channel.
You need the AI to produce output using those tags. You also want a separate LinkedIn version in the same response, clearly delimited so your code can split them apart.
- In index.js, find the generatePost function and replace it entirely with this updated version:
async function generatePost(topic) {
const prompt = `You are a developer content creator. Generate TWO versions of a developer post about "${topic}".
FORMAT YOUR RESPONSE EXACTLY LIKE THIS:
---TELEGRAM---
A developer post using HTML formatting:
- Use <b>bold</b> for headings
- Use <i>italic</i> for emphasis
- Use bullet characters (•) for lists
---LINKEDIN---
A LinkedIn-style post:
- Start with an attention-grabbing hook
- Use short paragraphs
- Include bullet points with insights
- End with a question
- Add 3-5 relevant hashtags`;
const interaction = await ai.interactions.create({
model: "gemini-3.5-flash",
input: prompt,
});
return interaction.output_text;
}
What does this prompt do?
The prompt uses clear delimiters (---TELEGRAM--- and ---LINKEDIN---) to tell the AI exactly where each section starts. This makes it easy to split the response in code later.
The Telegram section asks for HTML tags because Telegram's Bot API renders <b> as bold and <i> as italic when you enable HTML parse mode. The LinkedIn section asks for a hook, short paragraphs, and hashtags because that format performs well on the platform.
- Save index.js and run the tool to see the new structured output:
node index.js "async/await"
You should see the AI's response printed in your terminal with visible ---TELEGRAM--- and ---LINKEDIN--- delimiters separating the two sections. The post also goes to your Telegram channel, but it still looks raw because the delimiters and HTML tags appear as plain text.
Seeing an error about the model?
Make sure model: "gemini-3.5-flash" is spelled exactly as shown. If you see a rate limit error, wait a minute and try again.
Help me debug this
Parse the response and enable HTML formatting
The AI now returns structured output, but your code still sends the entire raw response to Telegram. You need a function that splits the response at those delimiters, and you need to tell Telegram to render the HTML tags.
- In index.js, add this parseResponse function directly below the closing brace of generatePost:
function parseResponse(response) {
// Split the AI output at the delimiter markers
const telegramMatch = response.split("---TELEGRAM---")[1]?.split("---LINKEDIN---")[0]?.trim();
const linkedinMatch = response.split("---LINKEDIN---")[1]?.trim();
return {
telegram: telegramMatch || response,
linkedin: linkedinMatch || "",
};
}
What does this code do?
The function splits the AI response string at the ---TELEGRAM--- and ---LINKEDIN--- markers to isolate each section. The optional chaining (?.) handles cases where the AI might not include a delimiter perfectly.
If parsing fails, it falls back to using the entire response as the Telegram text and an empty string for LinkedIn. This way your tool never crashes on unexpected AI output.
- Now find the sendToTelegram function and locate the body: JSON.stringify section. Find this line:
text: text,
- Add parse_mode: "HTML", on the line directly after it, so the object now looks like this:
text: text,
parse_mode: "HTML",
Why parse_mode?
By default, Telegram treats message text as plain text. When you pass parse_mode: "HTML", Telegram's API interprets <b>, <i>, and other supported tags as formatting instructions instead of literal characters.
- Finally, replace the entire main function with this updated version that uses parseResponse and prints the LinkedIn output:
async function main() {
const topic = process.argv[2];
if (!topic) {
console.log('Usage: node index.js "your topic"');
process.exit(1);
}
console.log(`Generating post about "${topic}"...\n`);
const response = await generatePost(topic);
// Split the AI response into Telegram and LinkedIn sections
const { telegram, linkedin } = parseResponse(response);
console.log("Posting to Telegram...");
const result = await sendToTelegram(telegram);
if (result.ok) {
console.log("Posted to Telegram channel!\n");
}
// Print the LinkedIn version for easy copy-paste
if (linkedin) {
console.log("=".repeat(50));
console.log(" COPY THIS TO LINKEDIN:");
console.log("=".repeat(50));
console.log(linkedin);
console.log("=".repeat(50));
}
}
What changed in main?
Instead of sending the raw AI response directly to Telegram, main now calls parseResponse to split it into telegram and linkedin parts. Only the Telegram section gets posted to the channel.
The LinkedIn section prints between separator lines so you can easily spot it in your terminal output and copy-paste it directly.
- Save index.js.
Not sure where each piece goes?
The order in your file should be: imports at the top, then generatePost, then parseResponse, then sendToTelegram, then main, then the main() call at the very bottom.
Help me check my function order
Run and verify the formatted output
Everything is wired up. Before you run this, think about what you expect to see. Will the Telegram post look different from last time? What should appear in your terminal?
- Run the tool with a new topic:
node index.js "React hooks"
Your terminal should show a "Posted to Telegram channel!" confirmation followed by the LinkedIn version between separator lines. The LinkedIn text has a hook opening, short paragraphs, and hashtags at the end.
- Open your Telegram channel and check the new post.
The post now has bold headings and clean bullet points instead of the plain text wall from before. That is parse_mode: "HTML" doing its job.
Telegram post still looks plain?
Double check that you added parse_mode: "HTML", inside the JSON.stringify object in sendToTelegram. It must be at the same level as chat_id and text. Also confirm you saved the file after editing.
If you see a Telegram error about parsing entities, the AI may have produced malformed HTML. Run the command again with a different topic. The AI occasionally outputs a stray character that breaks parsing.
Help me debug my Telegram formatting
✔️ Awesome, I've got everything!
Great. Double check you saved index.js and move on to the Secret Mission.
ⓧ I'd like to double check the full code
Here is the complete index.js as it should look at the end of this step. Scroll through and confirm each function matches yours:
- Top section: imports, GoogleGenAI initialization, env var check.
- generatePost function with the dual-format prompt containing ---TELEGRAM--- and ---LINKEDIN--- delimiters.
- parseResponse function that splits on the delimiters.
- sendToTelegram function with parse_mode: "HTML" in the body.
- main function that calls parseResponse, posts the telegram section, and prints the linkedin section.
- main() call at the very bottom.
Your content generator now produces polished, formatted posts for two platforms from a single command. Next up, the Secret Mission adds style variety so your channel stays fresh.
Secret mission
Add Content Style Selector
Posting the same format every day gets stale. What if you could choose between quick tips, deep dives, and thread-style posts to keep your channel varied and engaging? Add a --style flag to your CLI tool so you can generate different content formats on demand.
Clean Up Your Resources
Clean Up Your Resources
Decide whether to keep your resources running, pause them to come back later, or delete them entirely. This project runs entirely locally with free API tiers, so there are no ongoing costs.
Resources you used:
- Project folder (dev-content-generator) with source code and node_modules.
- Telegram bot created via @BotFather.
- Gemini API key in Google AI Studio.
Keep everything running
No action needed. Choose this if you plan to keep generating content for your Telegram channel.
- Your project folder stays on your Desktop, ready to run anytime with node index.js "your topic".
- Your Telegram bot remains active and connected to your channel.
- Your Gemini API key stays valid in Google AI Studio.
Pause - I'll come back to this later
Shut down any running processes to free up memory. Your files and keys stay intact for when you return.
- Close any open terminal sessions running the tool.
- Close the dev-content-generator folder in VS Code if you want to free up editor space.
- Your .env file, Telegram bot, and Gemini API key all remain ready when you come back.
Delete - I don't want to use this again
Remove all project resources and start fresh. Follow each step below to clean up completely.
- Delete the project folder. On macOS/Linux, open your terminal and run:
rm -rf ~/Desktop/dev-content-generator
On Windows, open PowerShell and run:
Remove-Item -Recurse -Force ~\Desktop\dev-content-generator
- Delete your Telegram bot. Open @BotFather in Telegram, send /deletebot, and select the bot you created for this project.
- Delete your Gemini API key. Go to aistudio.google.com, open the API keys section, find the key you created, and click the delete (trash) icon next to it.
Nice Work!
Nice Work!
You just built a fully functional AI-powered content automation tool from scratch. One command in your terminal now generates polished dev posts and publishes them straight to your Telegram channel.
You've learned how to:
- Built a Node.js CLI tool that generates developer content from any topic using the Gemini AI API.
- Created a Telegram bot and automated posting formatted content to your dev channel.
- Practiced prompt engineering by iterating on AI instructions to produce structured, HTML-formatted output.
- Generated LinkedIn-ready content alongside Telegram posts for cross-platform publishing.
- Secret Mission: Added content style options to vary your posts between tips, deep dives, and threads.
Ready to quiz yourself?