Skip to content

Comments

Add webhook HTTP server for message queueing#20

Open
jlia0 wants to merge 1 commit intomainfrom
claude/add-webhook-queue-processor-GWkTo
Open

Add webhook HTTP server for message queueing#20
jlia0 wants to merge 1 commit intomainfrom
claude/add-webhook-queue-processor-GWkTo

Conversation

@jlia0
Copy link
Collaborator

@jlia0 jlia0 commented Feb 10, 2026

Summary

This PR adds a webhook HTTP server to the queue processor, enabling external systems to submit messages via HTTP requests instead of only through file-based queue operations.

Key Changes

  • New HTTP Server: Implemented a webhook server listening on a configurable port (default 3077) using Node's built-in http module
  • Webhook Endpoints:
    • POST /webhook/message — Accept JSON payloads to queue new messages with validation
    • GET /webhook/health — Health check endpoint returning queue statistics and uptime
    • GET /webhook/status/:messageId — Query the status of a queued message (queued, processing, completed, or not found)
  • Message Handling: Webhook messages are validated, assigned unique message IDs, and written to the incoming queue directory for processing
  • Configuration: Webhook port is configurable via .tinyclaw/settings.json with a sensible default
  • Security & Robustness:
    • Request body size limit (1MB) to prevent abuse
    • CORS headers for broad compatibility
    • Proper error handling and logging
    • Input validation for required fields (channel, sender, message)
  • Dependencies: Added http and crypto imports for server implementation and message ID generation

Implementation Details

  • Message IDs are generated using a combination of channel, timestamp, and random hex bytes for uniqueness
  • The server gracefully handles port conflicts and logs appropriate warnings
  • Queue status checks scan all three queue directories (incoming, processing, outgoing) to provide accurate message state
  • All webhook operations are logged for debugging and monitoring purposes

https://claude.ai/code/session_01Dcg3mDHsjpH6vzsqce15GU

Adds an HTTP API to the queue processor so external services can submit
messages without needing a dedicated channel client. The webhook writes
to the same file-based incoming queue, keeping the existing processing
pipeline unchanged.

Endpoints:
- POST /webhook/message  — accept and queue a new message
- GET  /webhook/health   — health check with queue depth counts
- GET  /webhook/status/:messageId — track message through the pipeline

Uses Node.js built-in http module (no new dependencies). Port defaults
to 3077 and is configurable via webhook_port in settings.json.

https://claude.ai/code/session_01Dcg3mDHsjpH6vzsqce15GU
@jlia0 jlia0 force-pushed the claude/add-webhook-queue-processor-GWkTo branch from 5dcce2a to 5d21952 Compare February 12, 2026 02:26
@jlia0 jlia0 mentioned this pull request Feb 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants