• We've moved. Our community is now at ownd.sh — latest discussions and updates live there.

✅ [TUTORIAL]✅How to Build an Automated Webhook Monitor Bot in Python✅

ironwings

Royal
Royal
ironwings Rep
0
0
Rep
23
ironwings Vouches
0
0
0
Vouches
0
Posts
477
Likes
68
Bits
2 YEARS
2 YEARS OF SERVICE
Hidden Content

Whether you run a Discord server, a Telegram channel, or a private forum, sending real-time notifications when a target website updates, posts new data, or drops a price is one of the most useful automations you can build.

V13jM1E.png


Here is a lightweight Python automation script that periodically monitors web endpoints and sends structured alerts straight to your Discord or Telegram webhooks.


1. The Core Monitoring Engine (Python 3.10+)

Install the required lightweight async libraries:

 

Code:

Code:
pip install aiohttp beautifulsoup4

 

Code:

Code:
import asyncio

from bs4 import BeautifulSoup

import aiohttp

# Replace with your actual Discord or Telegram Webhook URL

WEBHOOK_URL = "https://discord.com/api/webhooks/YOUR_WEBHOOK_ID/YOUR_WEBHOOK_TOKEN"

TARGET_SITE = "https://news.ycombinator.com/"

async def send_discord_alert(session, title, link):

    """Sends a formatted embed alert to a Discord Webhook"""

    payload = {

        "embeds": [

            {

                "title": f"? New Update Detected: {title}",

                "url": link,

                "color": 5814783,  # Hex color code (Blue)

                "footer": {"text": "Automated Webhook Monitor v1.0"},

            }

        ]

    }

    try:

        async with session.post(WEBHOOK_URL, json=payload) as resp:

            if resp.status in (200, 204):

                print(f"[+] Alert sent successfully for: {title}")

    except Exception as e:

        print(f"[!] Webhook delivery error: {e}")

async def check_target_site(session, seen_items):

    """Scrapes the target page and checks for new entries"""

    try:

        async with session.get(TARGET_SITE, timeout=10) as response:

            html = await response.text()

            soup = BeautifulSoup(html, "html.parser")

            # Extract the top headline from the target page

            top_entry = soup.select_one("span.titleline > a")

            if not top_entry:

                return

            title = top_entry.get_text()

            link = top_entry.get("href")

            # Alert only if this item hasn't been seen yet

            if link not in seen_items:

                print(f"[*] New item found: {title}")

                seen_items.add(link)

                await send_discord_alert(session, title, link)

    except Exception as e:

        print(f"[!] Scraper error: {e}")

async def main():

    seen_items = set()

    print("[*] Starting Webhook Monitor Service (Checking every 60s)...")

    async with aiohttp.ClientSession() as session:

        while True:

            await check_target_site(session, seen_items)

            # Polling interval (60 seconds)

            await asyncio.sleep(60)

if __name__ == "__main__":

    asyncio.run(main())

 2. How to Deploy This 24/7 For FreeRunning this on your home PC means it stops when your computer goes to sleep. To keep it running 24/7 without spending money:
- Free-Tier Cloud VPS: Set up a free-tier virtual machine on Oracle Cloud, AWS, or Google Cloud.

- Background Process Manager: Run the script using

Code:

Code:
[color=#c0392b]systemd[/color]

or

Code:

Code:
[color=#c0392b]pm2[/color]

so it automatically restarts if the server reboots:

Code:

Code:
pm2 start monitor.py --interpreter python3

 

3. Ways to Extend and Monetize This Tool
- Custom Server Alerts: Offer custom bot setups for Discord communities (price tracking, GitHub repo commit alerts, crypto/forex movement notifications) for $100–$300 per setup.

- Lead Alerts: Connect the scraper to local business directories or job boards so your sales team gets an instant alert the second a new listing appears.

 
ironwings's signature

SallyHan

Active member
SallyHan Rep
0
0
Rep
0
SallyHan Vouches
0
0
0
Vouches
0
Posts
56
Likes
0
Bits
1 MONTH
1 1 MONTH OF SERVICE

oficina13

Well-known member
oficina13 Rep
0
0
Rep
0
oficina13 Vouches
0
0
0
Vouches
0
Posts
155
Likes
1
Bits
2 YEARS
2 YEARS OF SERVICE

xebom92720

Member
xebom92720 Rep
0
0
Rep
0
xebom92720 Vouches
0
0
0
Vouches
0
Posts
11
Likes
0
Bits
1 MONTH
1 1 MONTH OF SERVICE

claudebotlol

Member
claudebotlol Rep
0
0
Rep
0
claudebotlol Vouches
0
0
0
Vouches
0
Posts
20
Likes
0
Bits
1 MONTH
1 1 MONTH OF SERVICE

179,167

126,023

1,405,739

Top