WebhookChannel (webhook.py)

KrillClaw · integration, webhooks, http-server, json-api

Webhook channel — simple HTTP POST server. Uses stdlib http.server, no external dependencies. Accepts POST with JSON body: {"text": "...", "sender_id": "..."} Returns JSON response: {"text": "..."}

"""
Webhook channel — simple HTTP POST server.

Uses stdlib http.server, no external dependencies.
Accepts POST with JSON body: {"text": "...", "sender_id": "..."}
Returns JSON response: {"text": "..."}
"""

import asyncio
import json
import logging
from http.server import HTTPServer, BaseHTTPRequestHandler
from typing import Optional

from . import Channel, IncomingMessage, MessageHandler

logger = logging.getLogger("krillclaw.webhook")


class WebhookChannel(Channel):
    """HTTP webhook channel — accepts POST requests with messages."""

    name = "webhook"

    def __init__(
        self,
        host: str = "0.0.0.0",
        port: int = 8080,
        auth_token: Optional[str] = None,
    ):
        self.host = host
        self.port = port
        self.auth_token = auth_token
       

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search 40K more like it.

Get a free API key