
Weekend Productivity Challenge: How I Built a Telegram AI Social Media Post Optimizer using Amazon Lightsail, Amazon Bedrock and OpenClaw
This blog post shares how one can create a Telegram bot that is optimized for social media posts. We have used Amazon Lightsail, OpenClaw, Claude Sonnet 4.6 for this bot
I wanted an AI assistant that could live inside Telegram and rewrite my LinkedIn posts professionally from anywhere.
I will initially use Amazon Lightsail to create an instance.
Why I Chose Amazon Lightsail
For this project, I wanted to build an AI-powered Telegram bot quickly without spending time configuring infrastructure from scratch. Amazon Lightsail provided a simple way to launch a virtual private server with predictable monthly pricing and an easy-to-use interface.
Unlike manually provisioning servers, installing dependencies, and configuring networking, Lightsail allowed me to focus on building the application itself. Since my goal was to create a productivity tool rather than manage cloud infrastructure, it was the perfect choice.
Why Not Amazon EC2? Why Amazon Lightsail instead?
Although Amazon EC2 offers greater flexibility and customization, it also requires more setup and operational management. I would have needed to:
- Launch and configure an EC2 instance
- Install Docker and other dependencies manually
- Configure security groups and networking
- Deploy OpenClaw myself
- Manage updates and maintenance
First, let's create an instance from Amazon Lightsail (search for this service from the AWS console)
Amazon Lightsail recently introduced an OpenClaw blueprint, allowing me to deploy an AI agent without manually installing Docker, Python dependencies, or configuring the gateway.

Why the OpenClaw Blueprint?
One of the biggest advantages of Amazon Lightsail is the availability of the OpenClaw Blueprint.
Instead of manually installing OpenClaw and all of its dependencies, the blueprint deploys a preconfigured environment that is ready to use within minutes. This significantly reduces setup time and lets builders focus on creating AI agents rather than configuring infrastructure.
Using the blueprint, I was able to start building my Telegram-based social media assistant almost immediately.
I will use the Platform: Linux Apps
And blueprint: OpenClaw
Then, create an SSH Key and choose that.
Enable the snapshots
And finally, choose the $24 USD/month size, which provides
- 4 GB Memory
- 2 vCPUs Processing
- 80 GB SSD Storage
- 2 TB Transfer

Finally, gave this instance the name " AWSBuilder-Challenge "
Then, I will connect with the instance using the SSH key I just created earlier. So, chose the option "Connect using SSH"

Then Copy the Dashboard URL and paste it into a browser

Finally, copy the Gateway Token and paste it in the "Gateway Token" option. Finally, press the "Connect" option

You should still face issues connecting it. So, let's get back to the terminal and press: "y"

It will look for any devices that want to ask for pairing.
Got one! Let's press "a"

Then, press "n" for Change model and "n" for Security settings.
This means we are using Claude Sonnet -4.6 here.
You should now be able to log in using the "connect" button.
Note: If it does not work, follow the process again.
But our instance doesn't have any power/permission to do stuff now. Let's give it all the permissions needed.
From the instance page, you will see this: "Enable Amazon Bedrock as your model provider."

Let's press "Launch CloudShell" and then copy this script and paste it into the CloudShell
This script creates an IAM role that allows my OpenClaw instance to securely call Amazon Bedrock without storing AWS credentials.
Why Amazon Bedrock?
To make the bot intelligent, I used Amazon Bedrock as the model provider.
Amazon Bedrock provides secure access to foundation models through a managed AWS service. Rather than managing my own model endpoints or inference servers, OpenClaw sends requests directly to Amazon Bedrock, which handles model inference and scaling.
This allowed me to concentrate on designing the agent's behavior instead of managing AI infrastructure.
For this project, I selected Claude Sonnet as the reasoning model through Amazon Bedrock.
Claude Sonnet performs tasks such as:
- Understanding user intent
- Rewriting social media posts
- Improving grammar and tone
- Creating professional LinkedIn content
- Generating engaging captions
By combining OpenClaw's agent capabilities with Claude Sonnet's reasoning, the Telegram bot can transform rough ideas into polished social media posts.
Why an IAM Role Is Needed?
By default, a newly created Lightsail instance does not have permission to call Amazon Bedrock.
To enable AI inference, I created and attached an IAM Role that grants the required Bedrock permissions.
This IAM Role allows the OpenClaw instance to:
- Authenticate securely with AWS
- Invoke foundation models through Amazon Bedrock
- Access only the services it has been explicitly permitted to use
Using an IAM Role is more secure than storing long-lived AWS access keys on the server because AWS automatically provides temporary credentials to the instance. This follows the principle of least privilege, ensuring the application receives only the permissions it needs to function.
Now, say "Hi" to the chat option in the OpenClaw dashboard

Now go back to ssh terminal and paste these
openclaw config set tools.profile full
openclaw gateway restart
Let's try to add Telegram now
openclaw channels add
Then choose "Telegram (Bot API)."
You may find this error:

Now, choose "Finished" from the dropdown. And use these commands (in ssh terminal) to add it to the allowlist
openclaw --version
openclaw config get plugins
openclaw plugins list
openclaw gateway status
openclaw doctorChoose "yes" for recommended config repairs now and "No" for disabling 36 unavailable skills in the config; finally, "yes" for Enable bash shell completion for openclaw. The doctor will be complete!
systemctl --user stop openclaw-gateway.service
openclaw config set plugins.enabled true
openclaw config set plugins.allow '["telegram"]'
openclaw config set plugins.entries.telegram.enabled true
openclaw gateway install --force
systemctl --user start openclaw-gateway.serviceThis enables the telegram bot permission.
openclaw plugins list | grep telegramThis verifies if the plugin Telegram is there now.

Now go to Telegram and search for @BotFather channel

Now write /newbot
Let's give it a name: social_media_optimizer_bot
It will provide the bot link starting with "t.me/socia_*******" (This is the bot link)
and share an HTTP API
Let's go back to ssh terminal now and then add the telegram bot now using the HTTP API
openclaw channels add
Paste the HTTP API token here, then choose "Finished" as the channel. Finally, choose "No" for Configure DM access policies, "No" for name these channel accounts now, "Yes" for Route these channel accounts to agents; finally, "main(default)" for send telegram/default messages to agent.
Now press the bot link

Now press "Start," and it will provide a code like this
openclaw pairing approve telegram <CODE>Paste them into the SSH terminal.
Then, enable web search for them
sed -i 's/"mode": "all"/"mode": "non-main"/' ~/.openclaw/openclaw.json
openclaw gateway restartThen, let's give this bot instructions to work as my social media post optimizer
Rather than hardcoding prompts into my application, I customized OpenClaw's
SOUL.md , giving my agent a permanent personality as a social media post optimizer.Paste these into your SSH terminal, changing your bot name, owner name, timezone, etc.
cat > ~/.openclaw/workspace/SOUL.md << 'EOF'
# Identity
Name: [Give your desired bot name]
Owner: [Owner name]
Timezone: [Time zone]
# Mission
You are my personal AI assistant focused on helping me with AI communities, software engineering, technical writing, and professional communication.
# Behavior
- Be concise, professional, and human-like.
- Always preserve factual accuracy.
- Never invent achievements, statistics, or events.
- Ask for confirmation before any destructive action.
- Use my timezone for all time references.
- When you receive a voice note, always respond with a voice note using sag.
- If I paste text without any instruction, assume I want it professionally rewritten.
- Keep technical explanations beginner-friendly unless I request otherwise.
- If information is uncertain, clearly state the uncertainty instead of guessing.
# Social Media Writing
- Rewrite posts to sound professional while preserving my original intent.
- Improve grammar, clarity, readability, and flow.
- Never use clickbait or exaggerated claims.
- Never use phrases like "I'm excited to announce."
- Prefer a confident, humble, and authentic tone.
- Focus on impact, community, learning, and collaboration.
- Keep paragraphs short and easy to read.
- Only include hashtags when appropriate (maximum 5).
- Do not add emojis unless I ask.
# Professional Emails
- Write emails that are polite, concise, and professional.
- Keep instructions clear and actionable.
- Preserve names, dates, links, and technical information exactly.
# Technical Assistance
- Help with AWS, OpenAI, Codex, Qwen, Azure AI, Google AI, Cloud Native, MLOps, Kubernetes, and open-source technologies.
- Prefer practical solutions with commands and code examples.
- Explain errors and suggest the simplest fix first.
# Community Work
- Help organize meetups, hackathons, workshops, and community events.
- Generate event descriptions, agendas, announcements, and follow-up emails.
- Optimize LinkedIn, X, Facebook, and Meetup posts.
# Personal Preferences
- Keep responses natural instead of sounding AI-generated.
- Prefer quality over excessive wording.
- Return the final answer directly unless I explicitly ask for an explanation.
EOFNow, verify the changes in the SOUL.md file ( Go to the OpenClaw dashboard, then choose Agent, then 'SOUL', and then the preview button)
Run security audits
openclaw security audit --fix # apply safe auto-remediationsopenclaw config get gateway.bind # should be: loopback ✅
openclaw config get tools.profile # should be: fullNow, if pressed "/start", you can see your BOT working. Then, give it instruction to make a social media post optimized:

I wanted a post specified for "LinkedIn"

That's it!
My bot is working perfectly. I can now post this on my LinkedIn

This bot helps me:
- rewrite LinkedIn posts
- improve grammar
- generate hashtags
- create Twitter/X versions
- shorten long posts
- make announcements sound professional
That's it! Let me know if you also found this blog interesting and made a bot of your own
Note:
This bot charged me $1 USD and will cost me around $25 per month. So, if you want to follow these steps, you will be charged accordingly. So, don't follow this blog if you don't want to be charged that much. Finally, delete the resources after you are done using the bot.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article