This guide explains how to add an independent photo wall for a new Telegram group. Each group requires its own Bot.
- The project has been deployed at least once (
./deploy.shornpx cdk deploy) - AWS CLI is installed and credentials are configured
- You have a Telegram account
- Open Telegram and search for @BotFather
- Send
/newbot - Provide a Bot name (e.g.
Marketing Wall Bot) and a username (e.g.marketing_wall_bot, must end inbot) - Save the returned Bot Token
- Turn off Privacy Mode: BotFather →
/mybots→ select the Bot → Bot Settings → Group Privacy → Turn off
aws secretsmanager create-secret \
--name "telegram/bot-token/marketing" \
--secret-string "YOUR_NEW_BOT_TOKEN" \
--region us-west-2The
marketingsuffix intelegram/bot-token/marketingis arbitrary; it just has to match thesecretNameyou set in the next step.
Edit the project root cdk.json and append a new entry to the telegramGroups array:
{
"context": {
"telegramGroups": [
{
"groupId": "demo-group",
"chatId": "-1001234567890",
"name": "Demo Photo Wall",
"secretName": "telegram/bot-token/demo-group",
"botUsername": "your_photo_wall_bot"
},
{
"groupId": "marketing",
"chatId": "-1009876543210",
"name": "Marketing Photo Wall",
"secretName": "telegram/bot-token/marketing",
"botUsername": "marketing_wall_bot"
}
]
}
}| Field | Required | Description | Example |
|---|---|---|---|
groupId |
Yes | URL identifier for the wall; letters, digits, underscore, hyphen only | marketing |
chatId |
Yes | Telegram group Chat ID (negative integer); see the appendix for how to obtain it | -1009876543210 |
name |
Yes | Title shown on the photo wall page | Marketing Photo Wall |
secretName |
Yes | Name in Secrets Manager that holds the Bot Token; must match Step 2 | telegram/bot-token/marketing |
botUsername |
Yes | The Bot's @username (without @); only messages that @mention it are surfaced on the wall |
marketing_wall_bot |
cd photo-wall && npm run build && cd ..
npx cdk deploy --require-approval neverAfter the deployment, the CDK output prints the new group's webhook URL:
TelegramPhotoWallStack.WebhookUrlmarketing = https://<YOUR_DOMAIN>/api/webhook/marketing
# Fetch the webhook verification secret
WEBHOOK_SECRET=$(aws secretsmanager get-secret-value \
--secret-id "telegram/webhook-secret" \
--query SecretString --output text \
--region us-west-2)
# Fetch the new Bot Token
NEW_BOT_TOKEN=$(aws secretsmanager get-secret-value \
--secret-id "telegram/bot-token/marketing" \
--query SecretString --output text \
--region us-west-2)
# Register the webhook
curl -X POST "https://api.telegram.org/bot${NEW_BOT_TOKEN}/setWebhook" \
-H "Content-Type: application/json" \
-d "{
\"url\": \"https://<YOUR_DOMAIN>/api/webhook/marketing\",
\"secret_token\": \"${WEBHOOK_SECRET}\",
\"allowed_updates\": [\"message\"]
}"Replace
https://<YOUR_DOMAIN>with the actual CloudFront URL emitted by CDK.
curl -s "https://api.telegram.org/bot${NEW_BOT_TOKEN}/getWebhookInfo" | python3 -m json.tool- Open the target Telegram group
- Add member → search for
@marketing_wall_bot→ add - Send a test message in the group:
@marketing_wall_bot hello
https://<YOUR_DOMAIN>/wall/marketing
If multiple groups are configured, a group switcher appears at the top of the page.
Method 1: Via the Bot API
- Add the Bot to the group
- Send any message in the group
- Run:
curl -s "https://api.telegram.org/bot${NEW_BOT_TOKEN}/getUpdates" | python3 -m json.tool- Locate
message.chat.idin the returned JSON (group Chat IDs are negative, e.g.-1009876543210)
Method 2: Via @userinfobot
- Add
@userinfobotto the group - It will reply with the group's Chat ID
- Remove it once you have the value
- Remove the entry from
telegramGroupsincdk.json - Redeploy:
npx cdk deploy - (Optional) Delete the Bot Token:
aws secretsmanager delete-secret --secret-id "telegram/bot-token/marketing" --region us-west-2 - (Optional) Remove the webhook:
curl -X POST "https://api.telegram.org/bot${NEW_BOT_TOKEN}/deleteWebhook"
| Step | Command / Action |
|---|---|
| 1. Create the Bot | BotFather /newbot + turn off Privacy Mode |
| 2. Store the Token | aws secretsmanager create-secret ... |
| 3. Update config | Edit cdk.json, append the new group |
| 4. Deploy | npx cdk deploy |
| 5. Register webhook | curl ... setWebhook |
| 6. Add Bot to group | Add as a Telegram group member |
| 7. Test | Send @bot hello in the group, open /wall/groupId |