Integrate AiSecam With Telegram Bot Alerts
AiSecam's person detection runs locally in your browser, but what if you want to know the moment someone walks into the frame — even when you are not watching? Telegram bot integration solves this. When a person is detected, AiSecam can send a photo alert directly to your Telegram chat. Here is how to set it up.
Why Telegram?
Telegram is free, works on every platform, and its Bot API is straightforward. Unlike email or SMS, Telegram messages arrive instantly with minimal configuration. You do not need a server, a domain, or any programming knowledge. Your bot token stays on your device — AiSecam never transmits it to any server.
Creating Your Bot
- Open Telegram and search for @BotFather. This is Telegram's official bot for creating and managing bots. Start a conversation with it.
- Send the command
/newbot. BotFather will ask you to choose a name for your bot (this can be anything, like "My Security Cam Bot"). - Choose a username. This must end in "bot" — for example,
my_seccam_bot. This username is how people will find your bot. - Copy the bot token. BotFather will respond with a long string like
123456789:ABCdefGHIjklMNOpqr.... This is your bot token — keep it safe and do not share it publicly.
Getting Your Chat ID
You need to tell the bot which Telegram chat to send alerts to. Here is the easiest way to find your chat ID:
- Open your bot in Telegram by searching for its username and sending it any message (like "hello").
- Visit this URL in your browser (replace
YOUR_TOKENwith your actual bot token):
https://api.telegram.org/botYOUR_TOKEN/getUpdates - Find the "chat" object in the JSON response. Look for
"id":followed by a number — that is your chat ID. It is usually a negative number for groups or a positive number for private chats.
Configuring AiSecam
Once you have both the bot token and chat ID, configuring AiSecam takes seconds:
- Open the camera on AiSecam and start the live feed.
- Open Settings in the camera panel.
- Enable Telegram notifications and paste your bot token and chat ID into the respective fields.
- Customize the alert caption — you can use a template like
Person detected at {{time}}to include the detection timestamp. - Test the connection — walk in front of the camera. Within a few seconds, you should receive a photo in your Telegram chat.
How Alerts Work
When person detection triggers, AiSecam captures a frame from the camera, packages it as an image, and sends it to your Telegram chat via the Telegram Bot API. The photo is taken directly from the browser — it is not uploaded to AiSecam servers first. The Telegram API call happens from your browser using fetch.
Your bot token is stored in the browser's IndexedDB alongside your other settings. It is never transmitted to aisecam.com or any other server.
Customizing Alert Behavior
AiSecam provides several options for tuning alert behavior:
- Alert cooldown — set a minimum interval between alerts to avoid flooding your chat when someone is continuously in frame
- Detection confidence — only send alerts when the model is highly confident a person was detected
- Caption templates — include timestamps, device name, or custom text in each alert
- Enable/disable per session — turn alerts on or off without removing your configuration
Privacy Considerations
When you send a photo through Telegram, it traverses Telegram's servers (which use end-to-end encryption for secret chats, but standard encryption for regular bot messages). The photo contains whatever your camera sees — be mindful of what is in frame. For maximum privacy, position the camera to capture only the area you want monitored.
Your bot token grants full control over your bot, including reading its message history. Treat it like a password. If you suspect it has been compromised, revoke it through BotFather and create a new bot.
Set up alerts in minutes
Open AiSecam, configure your Telegram bot, and get instant person detection notifications.
Start camera and configure alerts