Monitor APIs With Telegram Alerts
Schedule daily health checks for your APIs and instantly receive a Telegram alert if any endpoint goes down or returns an error, ensuring maximum uptime and reliability.
API Health Checker
This workflow automatically checks the health of your APIs every day and sends you an alert on Telegram if any of them are down. It makes sure you stay informed about your API status without needing to monitor them manually.
It performs the following steps:
- Runs a scheduled trigger every day at 9:00 AM UTC.
- Defines and lists the APIs you want to monitor.
- Sends a request to each API endpoint and collects their responses.
- Analyzes the responses, identifies any issues, and sends a detailed alert message to your Telegram chat if problems are found.
What You Need
Ensure you have the following prerequisites ready before running the workflow:
| Requirement | Description |
|---|---|
| Needle Account | An active account on the Needle platform with access to workflow automation. |
| Telegram Bot Token | Your bot's token (TELEGRAM_BOT_TOKEN) with permission to send messages. |
| Telegram Chat ID | The chat ID (TELEGRAM_CHAT_ID) where you want the alerts delivered. |
| API Endpoints | The list of API URLs you want to monitor. |
How the Flow Works
| Node | Purpose |
|---|---|
| Scheduled Trigger | Triggers the workflow every day at 9:00 AM UTC to start the health check. |
| API List Code Node | Defines the list of API endpoints to monitor. Each API has a name and a URL. |
| HTTP Request Node | Sends a GET request to each API URL from the list, collecting the response for further analysis. |
| Analysis Code Node | Checks each API's response status and errors, determining if the API is down or healthy. It compiles a summary message. |
| Telegram Notification Node | If there are any API failures, this node sends the alert message to your specified Telegram chat. |
Output
At the end of the execution, you will receive a Telegram message in your chosen chat. This message will either confirm all APIs are healthy or list the APIs that are down along with their status codes and error details.
Notes
- Customize the list of APIs by editing the first code node where the APIs are defined.
- To change the notification schedule, adjust the cron expression in the scheduled trigger.
- Keep your Telegram bot token and chat ID secure as workflow variables.
- The workflow tolerates request errors and continues running through all APIs to give a complete health picture.
Want to showcase your own workflows?
Become a Needle workflow partner and turn your expertise into recurring revenue.
