๐ฏ Purpose: This tool helps you verify that your Telegram bot is configured correctly before uploading code to your ESP32.
It tests the exact same values you'll use in your
secrets.h file.
1Create Telegram Bot (if not done)
If you haven't created a bot yet:
- Message @BotFather on Telegram
- Send
/newbot - Choose a name: "Motion Alert Bot"
- Choose username: "your_motion_alert_bot"
- Copy the token (looks like:
1234567890:ABCdefGHIjklMNOpqrSTUvwxYZ123456789)
2Get Your Chat ID
This is the most important step! Your Chat ID tells the bot where to send messages.
๐ฏ Step 2.1: Choose Your Notification Type
Select how you want to receive motion alerts:
๐ฑ Step 2.2a: Personal Chat Setup
- Find your bot in Telegram (search for the username you created)
- Send any message to your bot (like "hello" or "test")
- The bot won't reply yet - that's normal!
๐ Step 2.3: Find Your Chat ID
๐ Manual Method: You can also visit this URL in your browser:
Look for
https://api.telegram.org/bot<YOUR_TOKEN>/getUpdatesLook for
"chat":{"id":123456789} - the number after "id" is your Chat ID.
๐ Chat ID Examples
- Personal Chat:
123456789(positive number) - Group Chat:
-123456789(negative number) - Channel:
-1001234567890(starts with -100)
3Test Your Configuration
ESP32 Code: This goes to
BOT_TOKEN in your secrets.h file
ESP32 Code: This goes to
CHAT_ID in your secrets.h file
4Update Your ESP32 Code
Once the test passes, update your ESP32 project:
File:
Line 10:
Line 11:
Line 14:
Line 15:
include/secrets.hLine 10:
const char* WIFI_SSID = "Your_WiFi_Name";Line 11:
const char* WIFI_PASSWORD = "Your_WiFi_Password";Line 14:
const char* BOT_TOKEN = "YOUR_TESTED_TOKEN";Line 15:
const char* CHAT_ID = "YOUR_TESTED_CHAT_ID";
โ
Next Steps After Testing:
- Copy your tested values to
secrets.h - Wire your PIR sensor to ESP32
- Upload:
pio run --target upload - Monitor:
pio device monitor - Test motion detection!