Skip to content

Create Email Service HTTP Endpoint

Add HTTP endpoint to email service to accept POST requests with same JSON payload as SQS. Deploy as container instead of Lambda.

Note:

  • HTTP endpoint: POST /send (or similar path)
  • Request body: JSON with same structure as SQS message body (see TBD-04)
  • Response: Success/error with appropriate HTTP status codes
  • Container deployment: Dockerize existing email service
  • Keep existing SQS handler for backward compatibility
  • Configure via env vars: HTTP_PORT, HTTP_HOST
  • Error handling: return 4xx/5xx with error details in response body

Example(s):

Request:

POST /send
Content-Type: application/json

{
  "to_addresses": ["email@example.com"],
  "template": "magic-link-login",
  "namespace": "aktion",
  "template_vars": {
    "magic_link_url": "https://example.com/auth/verify?token=xyz",
    "expiration_minutes": 15
  }
}

Response (success):

HTTP/1.1 200 OK
Content-Type: application/json

{
  "success": true,
  "message_id": "some-id"
}

Response (error):

HTTP/1.1 400 Bad Request
Content-Type: application/json

{
  "success": false,
  "error": "Invalid template name"
}