Batch signature and approval notifications via debounced worker
Replace the immediate per-document approval email and the manual "send signing notifications" action with a single debounced worker that batches pending requests per recipient and organization. The worker (go.gearno.de/kit/worker) polls on an interval (default 5m) and claims one (organization, recipient) group at a time, sending one consolidated signing email and/or one approval email per recipient/org that lists every document awaiting their signature or approval. The claim is a conditional UPDATE that doubles as concurrency-safe dedup, so several workers never email the same group twice. Each request is notified once it has been pending past the debounce delay (default 15m), then reminded at 1x, 2x and 3x the reminder interval (default 1 day) after the previous email, after which it stops. New last_notified_at and notification_count columns on signatures and approval decisions drive the debounce, the widening reminder cadence and the four-email cap. Email copy lists each document with its title, type and a deep link to the employee page. Removed the inline approval-on-publish email, the SendSigningNotifications service method/mutation/MCP tool, its IAM action, and the related console UI and n8n operation. Signed-off-by: Sacha Al Himdani <sacha@probo.com>
This commit is contained in:
committed by
Sacha Al Himdani
parent
c9b74bac4a
commit
f462b124e6
@@ -15,12 +15,26 @@
|
||||
package probodconfig
|
||||
|
||||
type NotificationsConfig struct {
|
||||
Mailer MailerConfig `json:"mailer"`
|
||||
Slack SlackConfig `json:"slack"`
|
||||
Webhook WebhookConfig `json:"webhook"`
|
||||
Mailer MailerConfig `json:"mailer"`
|
||||
Slack SlackConfig `json:"slack"`
|
||||
Webhook WebhookConfig `json:"webhook"`
|
||||
Document DocumentNotificationConfig `json:"document"`
|
||||
}
|
||||
|
||||
type WebhookConfig struct {
|
||||
SenderInterval int `json:"sender-interval"`
|
||||
CacheTTL int `json:"cache-ttl"`
|
||||
}
|
||||
|
||||
// DocumentNotificationConfig configures the debounced worker that batches
|
||||
// signature and approval request notifications. All durations are in seconds.
|
||||
type DocumentNotificationConfig struct {
|
||||
// Interval is how often the worker scans for pending requests.
|
||||
Interval int `json:"interval"`
|
||||
// DebounceDelay is how long a request must have been pending before its
|
||||
// first notification is sent.
|
||||
DebounceDelay int `json:"debounce-delay"`
|
||||
// ReminderInterval is the base reminder cadence. Reminders are sent at
|
||||
// 1x, 2x and 3x this interval after the previous email, then stop.
|
||||
ReminderInterval int `json:"reminder-interval"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user