invitation: invite_on_approve — automation #11

Closed
opened 2026-02-28 08:39:59 +00:00 by ash · 0 comments
Owner

🟣 Automation Slice

Trigger: SignupApproved event
Action: Generates invite code → sends SendInvite{Email, InviteCode} command

Implementation

automation.New(automation.Config{
    Name: "invite_on_approve",
    Trigger: func(evt) *TodoItem {
        e, ok := evt.Data.(*review.SignupApproved)
        if !ok { return nil }
        code := generateInviteCode()
        return &TodoItem{Key: "invite:" + e.Email, Command: SendInvite{Email: e.Email, InviteCode: code}}
    },
    Execute: func(item) error {
        _, err := bus.SendAndWait(ctx, item.Command, 5*time.Second)
        return err
    },
})

Tests

TestInviteOnApprove_Triggers
TestInviteOnApprove_IgnoresOtherEvents
TestInviteOnApprove_DeterministicKey

Agent assignment: builder-invite

## 🟣 Automation Slice **Trigger:** `SignupApproved` event **Action:** Generates invite code → sends `SendInvite{Email, InviteCode}` command ### Implementation ```go automation.New(automation.Config{ Name: "invite_on_approve", Trigger: func(evt) *TodoItem { e, ok := evt.Data.(*review.SignupApproved) if !ok { return nil } code := generateInviteCode() return &TodoItem{Key: "invite:" + e.Email, Command: SendInvite{Email: e.Email, InviteCode: code}} }, Execute: func(item) error { _, err := bus.SendAndWait(ctx, item.Command, 5*time.Second) return err }, }) ``` ### Tests ``` TestInviteOnApprove_Triggers TestInviteOnApprove_IgnoresOtherEvents TestInviteOnApprove_DeterministicKey ``` **Agent assignment:** builder-invite
ash closed this issue 2026-02-28 08:50:36 +00:00
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ash/waitlist#11
No description provided.