Documentation Index
Fetch the complete documentation index at: https://mintlify.com/danielitoCode/AlejoTaller/llms.txt
Use this file to discover all available pages before exploring further.
alejo_publisher exposes exactly two HTTP endpoints. The health endpoint requires no credentials and is used by uptime monitors and load balancers. The publish endpoint requires a Bearer token and is called exclusively by the operator application after it has confirmed a sale decision in Appwrite.
GET /health
Returns a static JSON object confirming the service is running. No authentication is required. This endpoint is safe to poll from external monitors. Response — 200 OKAlways
true when the service is up.Always
"alejo_publisher".POST /sale-verification/publish
Validates the sale decision command and publishes the corresponding event to the customer’s Pusher channel. The operator application calls this endpoint after it has successfully written the sale state to Appwrite.Authentication
Every request must include a valid Bearer token in theAuthorization header. The token is matched against the PUBLISHER_API_KEY environment variable configured on the server.
401 before the request body is ever parsed.
Request Body
The Appwrite document ID of the sale being verified. Must be a non-empty string. Example:
"69c9593b002b167bf4fb".The Appwrite user ID of the customer. Used to construct the Pusher channel name:
sale-verification-{userId}. Must be a non-empty string. Example: "698f82750024bfe2dc52".The operator’s verdict for the sale. Must be exactly
"confirmed" or "rejected". Any other value returns a 400 validation error.Total monetary amount of the sale. Forwarded as-is to the Pusher event payload. Accepts
null.Number of line items in the sale. Forwarded as-is to the Pusher event payload. Accepts
null.Human-readable reason for a rejection. Should be provided when
decision is "rejected" so the customer app can display a meaningful message. Accepts null.Successful Response — 200 OK
true when the Pusher trigger call succeeded.The Pusher channel that received the event. Always formatted as
sale-verification-{userId}.The Pusher event name that was triggered. Either
"sale:confirmed" or "sale:rejected", derived directly from the decision field.Channel and Event Naming
The channel name and event name are derived deterministically from the request body:| Field | Input value | Result |
|---|---|---|
channel | userId = "698f82750024bfe2dc52" | "sale-verification-698f82750024bfe2dc52" |
eventName | decision = "confirmed" | "sale:confirmed" |
eventName | decision = "rejected" | "sale:rejected" |
sale-verification-{their own userId} and listen for both sale:confirmed and sale:rejected events.
Error Responses
All error responses share the same shape:| Status | Cause | Example message |
|---|---|---|
400 | saleId is missing or blank | "saleId es obligatorio" |
400 | userId is missing or blank | "userId es obligatorio" |
400 | decision is not "confirmed" or "rejected" | "decision debe ser confirmed o rejected" |
401 | Missing or incorrect Bearer token | "Unauthorized" |
500 | Pusher SDK error or unexpected exception | Error message from the SDK |
The
400 vs 500 split is handled automatically in the error middleware: any error message containing "obligatorio" or "decision debe" maps to status 400; everything else maps to 500.