herostools.actor.webhook ======================== .. py:module:: herostools.actor.webhook Classes ------- .. autoapisummary:: herostools.actor.webhook.HEROWebhookSender Module Contents --------------- .. py:class:: HEROWebhookSender(webhook_url: str, body_template: str, request_timeout: float = 10, *args, **kwargs) Bases: :py:obj:`herostools.actor.archiver.base.HERODataArchiver` HERODataArchiver that renders metadata and payload into a JSON template and posts them to an arbitrary incoming-webhook endpoint. Works with any webhook-compatible platform (Slack, Mattermost, Discord, MS Teams, ...) since the payload format is fully defined by the template. :param object_selector: Zenoh object selector for the devices to subscribe to. :param event_name: Name of the event. :param webhook_url: Full URL of the incoming webhook endpoint. :param default_metadata: Default metadata merged with every incoming payload's metadata. :param body_template: Template for POST message body as JSON string rendered with Jinja2, using the payload and metadata as template variables (e.g. ``'{"text": {{ payload.value | tojson }}}'``). Rendering payload only works, if it is json serializable. :param max_retries: Number of times to retry a failed delivery before dropping the item. :param request_timeout: Timeout in seconds for the POST request to the webhook endpoint. .. py:attribute:: _payload_in_template .. py:attribute:: _webhook_url .. py:attribute:: _template .. py:attribute:: request_timeout :value: 10 .. py:method:: _store(source_name: str, payload: Any, metadata: dict) -> None Send the payload array as webhook. :param source_name: Name of the event source (the HERO). :param payload: Incoming data. :param metadata: Incoming metadata merged with ``default_metadata``.