from __future__ import annotations import httpx async def send_incoming_webhook( webhook_url: str, text: str = "", *, title: str = "", card: dict | None = None, theme_color: str | None = None, ) -> dict: payload: dict = {} if text: payload["text"] = text if title: payload["title"] = title if theme_color: payload["themeColor"] = theme_color if card: attachments = [{ "contentType": "application/vnd.microsoft.card.adaptive", "content": card, }] payload["attachments"] = attachments async with httpx.AsyncClient(timeout=15.0) as client: resp = await client.post(webhook_url, json=payload) resp.raise_for_status() return {"status": "ok"}