Pranav GudiseCode on GitHub

iMessage reorder agent, tested on 28 conversations

A coffee chain member texts "the usual," confirms, pays with an Apple Pay link, and gets a text when it's ready. The agent is built on Linq's iMessage API (v3). Anything outside the saved usual goes to a person.

28 conversations, 9 rules

Switch a rule off to see which conversations break and why.

28of 28 passNo critical failures
0 CRITICAL
PassedFailedCritical failureEach square is one conversation. Select one to read it.

What breaks now

    Rules the agent follows

    All on to start. Under each rule: what breaks when only that rule is off.

    The 28 conversations

    Open one to read the texts. If it fails with your current switches, you also see what happens with every rule off.

    On its own, or to a person

    On its own

    Answers order status. Reorders the saved usual after a YES, sends the payment link, and texts when it's ready.

    Goes to a person

    New items, changes to the usual, refunds, complaints, allergy questions, orders over $30, and a second unclear text.

    Never

    Texts anyone who opted out, acts on a webhook with a bad signature, or sends the same order to the kitchen twice.

    Intent comes from a small keyword reader so these results are repeatable; a model can be plugged in with the same labels. Either way, the agent only ever orders the member's saved usual, after a YES, and its confirmation repeats the drink and the store, so a misread is visible before anyone pays.

    How it uses Linq

    • It starts a typing indicator before every reply and sends the payment link as its own link message.
    • It verifies each webhook's signature (Standard Webhooks) on the raw body.
    • It handles a webhook delivered twice only once: by event id, and by order state for replays, which get a new event id.
    • It puts an idempotency key on every send and payment request, so a retried call cannot text twice.
    • Payments go through POST /v3/payment_requests, and the order moves on only when the payment.succeeded webhook arrives.