Skip to main content

ulfblk-channels

Webhook handlers para WhatsApp (Meta Cloud API), Telegram (Bot API), y Email (inbound webhook + SMTP outbound).

Instalacion

uv add ulfblk-channels

Para email outbound (SMTP):

uv add ulfblk-channels[email]

WhatsApp

from fastapi import FastAPI
from bloque_channels.whatsapp import WhatsAppRouter, WhatsAppSettings

app = FastAPI()

settings = WhatsAppSettings(
    api_token="tu-token",
    verify_token="mi-token-verificacion",
    phone_number_id="123456789",
)

whatsapp = WhatsAppRouter(
    verify_token=settings.verify_token,
    on_message=lambda msg: print(f"Mensaje: {msg.text}"),
    settings=settings,
)

app.include_router(whatsapp.router, prefix="/webhook")

Telegram

from bloque_channels.telegram import TelegramRouter, TelegramSettings

settings = TelegramSettings(
    bot_token="123:ABC",
    secret_token="mi-secret",
)

telegram = TelegramRouter(
    on_message=lambda msg: print(f"Mensaje: {msg.text}"),
    settings=settings,
    secret_token=settings.secret_token,
)

app.include_router(telegram.router, prefix="/telegram")

Email

from bloque_channels.email import EmailRouter, EmailClient, EmailSettings

# Inbound (webhook)
email_router = EmailRouter(
    on_message=lambda msg: print(f"Email de: {msg.sender}"),
    webhook_secret="secret",
)
app.include_router(email_router.router, prefix="/email")

# Outbound (SMTP, requiere ulfblk-channels[email])
email_settings = EmailSettings(
    smtp_host="smtp.gmail.com",
    smtp_port=587,
    smtp_username="user@gmail.com",
    smtp_password="app-password",
    from_address="user@gmail.com",
)
client = EmailClient(email_settings)
await client.send_text("dest@example.com", "Asunto", "Cuerpo del email")

Health Check

from bloque_channels.health import channels_health_check
from bloque_channels.whatsapp import WhatsAppClient
from bloque_channels.telegram import TelegramClient

channels = {
    "whatsapp": whatsapp_client,
    "telegram": telegram_client,
}
status = await channels_health_check(channels)
# {"whatsapp": True, "telegram": False}

Dependencias

  • ulfblk-core (obligatorio)
  • httpx>=0.27 (obligatorio)
  • aiosmtplib>=3.0 (opcional, para email outbound)

License

MIT

Metadata

Release files for ulfblk-channels 0.1.0

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

Source distribution (sdist)

Source distribution for ulfblk-channels 0.1.0
File Size Uploaded
ulfblk_channels-0.1.0.tar.gz 11.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ulfblk-channels 0.1.0
File Interpreter ABI Platform
ulfblk_channels-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 27.1 kB

Release files / ulfblk_channels-0.1.0.tar.gz

Download URL ulfblk_channels-0.1.0.tar.gz
Size 11.1 kB
Tags Source
SHA-256 checksum
How to use checksums
1b4171b587b96c346e5ac8edd055776e8188777653db0a5cd676df65cdee3ea3
BLAKE2b-256 checksum
How to use checksums
d6ad8bcf76be4a7ca7bf032d1762721d89eaeef6c7ced4b43370d645209e4f50
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / ulfblk_channels-0.1.0-py3-none-any.whl

Download URL ulfblk_channels-0.1.0-py3-none-any.whl
Size 16.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
baec5c694f6ad31d17cefa6f882f918028b89d71dca0bfadffda497452d706ab
BLAKE2b-256 checksum
How to use checksums
629024f48c5bdf08728a86912e5e474b25d423e273d9007e130edbd6eb8a5f87
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

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