Monitor Your React Website Performance with Headless Browser & Telegram
Introduction
Discover how to create a monitoring service for your React-based website using a headless browser and Telegram. This guide will walk you through setting up a Telegram bot and integrating it with a headless browser to monitor your website's performance.
Setting Up Telegram Bot
Begin by creating a Telegram bot to automate performance reporting.
- Search for BFA on Google and start a conversation with the bot.
- Select New Bot, give it a name like Light Not WebBot, and set a username.
- Note the access token provided by the bot; you'll need it later.
- Enable the bot to join groups by clicking Help, selecting Join Groups, and choosing your bot.
- Create a group where the bot will send performance reports. Invite your bot to this group and note the group chat ID.
Creating the Monitoring Scenario in Late Night
Switch to the Light N platform to set up the monitoring scenario:
- Create a new scenario and add the following triggers:
- Schedule Trigger: Activates the scenario at set intervals.
- Webhook Trigger: Allows manual activation via a webhook link.
- Add a Headless Browser Node to perform website checks. Include the code to navigate to the authorization page and verify the presence of the "Create your account" text.
- Add two Telegram Nodes to send messages based on the headless browser's results:
- Send Text Message: Positive report if verification is successful.
- Send Text Message: Negative report if verification fails.
- Authorize the Telegram nodes by entering the access token and group chat ID.
- Set filters for success and error conditions:
- Success Filter: Activated if the headless browser's result is true.
- Error Filter: Activated if the result is false.
- Deploy the scenario and verify its operation by triggering the webhook.
- Check the history tab for execution logs and confirm the Telegram messages.
Conclusion
You've successfully created a website monitoring service using a headless browser and Telegram. For ready-to-use templates and further assistance, refer to the links in the description. Like, subscribe, and hit the bell for more tutorials. Happy automating!