๐Ÿค– ESP32 Motion Detection - Telegram Tester

Test your Telegram bot configuration before uploading to ESP32

๐ŸŽฏ 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:

  1. Message @BotFather on Telegram
  2. Send /newbot
  3. Choose a name: "Motion Alert Bot"
  4. Choose username: "your_motion_alert_bot"
  5. 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

  1. Find your bot in Telegram (search for the username you created)
  2. Send any message to your bot (like "hello" or "test")
  3. 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:
https://api.telegram.org/bot<YOUR_TOKEN>/getUpdates
Look 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: include/secrets.h

Line 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:
  1. Copy your tested values to secrets.h
  2. Wire your PIR sensor to ESP32
  3. Upload: pio run --target upload
  4. Monitor: pio device monitor
  5. Test motion detection!