Skip to content

Add structured health check endpoint to relay workers #7

@osisdie

Description

@osisdie

Overview

The LINE and WhatsApp relay workers (Cloudflare Workers) have a basic GET / health check that returns a simple text response. A structured JSON endpoint would help with monitoring and debugging.

What to do

  • Update GET / (or add GET /health) to return structured JSON
  • Include: service name, version, uptime, queue depth (KV key count), timestamp
  • Apply to both relay workers:
    • external_plugins/line-channel/relay/src/index.ts
    • external_plugins/whatsapp-channel/relay/src/index.ts

Example response

{
  "service": "whatsapp-relay",
  "version": "1.0.0",
  "status": "ok",
  "uptime_seconds": 3600,
  "queue_depth": 2,
  "timestamp": "2026-03-24T12:00:00Z"
}

Notes

  • Cloudflare Workers don't have persistent uptime, but you can track via a KV counter or Date.now() minus a stored start time
  • Queue depth: count keys in the KV namespace with list()
  • Keep the auth-free endpoint lightweight (no RELAY_SECRET needed)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions