Webhooks: post each new incoming message (closes #7)
check / check (push) Successful in 1m45s

Each message a contact sends in a direct chat is posted to each webhook
on that chat, as JSON holding `chat_id` and the message record of the
messages endpoint. The event handler only queues it: `api.Deliveries`
serves a queue of 100 with four goroutines, reads the chat's webhooks
there, and makes one POST per webhook, with a 10-second timeout, no
retry and no redirect followed. A full queue or a failed post is logged
by ids, never by URL or text. `bot.Run` stops it last, once the chat
client has exited. Tests cover the payload and its routing, a full
queue, failures, and a webhook that never answers; the README documents
the payload and what delivery promises.

Model: opus-5-5
This commit is contained in:
2026-09-29 07:19:56 +00:00
parent 397fc95149
commit 7170576a8e
8 changed files with 816 additions and 54 deletions
+9
View File
@@ -0,0 +1,9 @@
package api
// DeliveryGoroutines and QueueLength are deliveryGoroutines and
// queueLength, exported for the external test package, which fills the
// queue.
const (
DeliveryGoroutines = deliveryGoroutines
QueueLength = queueLength
)