Skip to main content

Meetup-Notifier

Meetup-Notifier is a simple Python script that collects events from Meetup.com and sends notifications to several platforms. The package is designed to be used as a CLI tool, but it can also be used as a library. It works by scraping the Meetup.com events page and extracting the relevant information from the HTML.

Installation

uv pip install meetup-notifier

Usage

The CLI tool can be used to get a json list of events from a Meetup.com page.

$ meetup-notifier events https://www.meetup.com/generative-ai-on-aws/events/

[{"link": "https://www.meetup.com/generative-ai-on-aws/events/303452518/", "name": "AWS Loft Event: Building Agentic Workflows on AWS (Hands-On Workshop!) (Repeat)", "description": "Hands-on workshop!...

Library

As a library, you can use the get_events function to get a list of MeetupEvent objects. And then send notification to a platform of your choice. The following example shows how to send notifications to a Telegram chat.

from meetup_notifier import get_events
from meetup_notifier.meetup import MeetupEvent
import typer
from typing_extensions import Annotated
from datetime import datetime, timedelta
import requests
from rich.console import Console

app = typer.Typer()
console = Console()


def notify_telegram(event: MeetupEvent, telegram_token: str, telegram_chat_id: str):
    url = f"https://api.telegram.org/bot{telegram_token}/sendPhoto"

    text = (
        f"{time_until_event(event)}\n"
        f"📝 [Apúntate aqui]({event.link})\n"
        f"📍 [{event.venue}]({event.location_link})\n"
        f"🗺️ {event.location}"
    )
    message_payload = {
        "chat_id": telegram_chat_id,
        "caption": text,
        "photo": event.image,
        "parse_mode": "Markdown",
    }

    response = requests.post(url, data=message_payload)
    response.raise_for_status()

    console.print(f"📢 Evento enviado a Telegram: {event.name}")


def time_until_event(event: MeetupEvent):
    now = datetime.now(event.date.tzinfo)  # Use event date timezone
    tomorrow_start = (now + timedelta(days=1)).replace(
        hour=0, minute=0, second=0, microsecond=0
    )
    day_after_tomorrow_start = (now + timedelta(days=2)).replace(
        hour=0, minute=0, second=0, microsecond=0
    )

    time_diff = event.date - now
    event_time_str = event.date.strftime("%H:%M")

    if event.date < now:
        return f"❗️ **El evento ya ocurrió** el {event.date.strftime('%Y-%m-%d')} a las {event_time_str} 🕒"
    elif now < event.date < tomorrow_start:
        return f"🎉 **¡El evento es hoy a las** {event_time_str}**!**"
    elif tomorrow_start <= event.date < day_after_tomorrow_start:
        return f"⏰ **¡El evento es mañana a las** {event_time_str}**!**"
    else:
        return f"📅 **El evento será dentro de {time_diff.days} días**"


@app.command()
def notify(
    events_url: str = typer.Argument(..., help="URL de la página de eventos de Meetup"),
    telegram_token: Annotated[str, "Token de Telegram"] = typer.Option(
        help="Token de Telegram",
        envvar="TELEGRAM_TOKEN",
    ),
    telegram_chat_id: Annotated[str, "Chat ID de Telegram"] = typer.Option(
        help="Chat ID de Telegram",
        envvar="TELEGRAM_CHAT_ID",
    ),
):
    if not telegram_token or not telegram_chat_id:
        console.print(
            "❌ Debes proporcionar un token y un chat ID de Telegram para enviar notificaciones"
        )
    events = get_events(events_url)
    for event in events:
        notify_telegram(event, telegram_token, telegram_chat_id)


if __name__ == "__main__":
    typer.run(notify)

To run the script, you need to provide the Telegram token and chat ID as environment variables.

 uv run --with meetup-notifier example.py "https://www.meetup.com/hiking-valencia/?eventOrigin=event_home_page" --telegram-chat-id TELEGRAM_CHAT_ID --telegram-token TELEGRAM_TOKEN

Metadata

Release files for meetup-notifier 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for meetup-notifier 0.1.2
File Size Uploaded Provenance Actions
meetup_notifier-0.1.2.tar.gz 70.6 kB Without provenance Details for meetup_notifier-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for meetup-notifier 0.1.2
File Interpreter ABI Platform Actions
meetup_notifier-0.1.2-py3-none-any.whl Python 3 none any Details for meetup_notifier-0.1.2-py3-none-any.whl

Total release size: 76.2 kB

Release files / meetup_notifier-0.1.2.tar.gz

Download URL meetup_notifier-0.1.2.tar.gz
Size 70.6 kB
Tags Source
SHA-256 checksum
How to use checksums
b353fe8016e12cd227f674940c7bc0e3c013c6a8ddcb5a5de5d7f0a45ffab5d7
BLAKE2b-256 checksum
How to use checksums
a70320738415284615a86e85fe50193849f4f08d70daf6175fc62a66b3aca7dd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.1 CPython/3.12.6

Release files / meetup_notifier-0.1.2-py3-none-any.whl

Download URL meetup_notifier-0.1.2-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cc9e6307c267ba783b0353d2cf8adb45755cb8c91f74c974a058fb564c508416
BLAKE2b-256 checksum
How to use checksums
f9865b13b62372f866ff503631e77bc08567c10c229fdbcbe91bd5cf3a0749e3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.1 CPython/3.12.6

Security for meetup-notifier 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page