Testing

Test an agent's inbox with a sandbox key: simulate received mail, follow threads and reply from any inbox, with nothing delivered.

Inboxes made with a sandbox (coss_test_…) key work end to end, with threads, webhooks and replies. What's different:

  • Every inbox can send, including one at coss.com's inbound domain (can_send: true), which only receives in live environments.
  • Nothing you send is delivered. Sends and replies are ordinary sandbox emails: they join the thread and get simulated events, so bounce@simulator.amazonses.com tests a bounce.
  • Inboxes are free. They aren't charged per day, but they do count towards your plan's limit on inboxes.
  • Sends count towards the sandbox's limit of 500 recipients a day per environment.

The whole loop

Create an inbox and forward its webhooks to your handler:

coss inboxes create --username support-agent
coss listen --forward-to localhost:3000/webhooks

Then give it mail, in either of two ways:

Either one files the message into a thread and sends inbox.message.received, with sandbox: true. Then read the conversation and reply, from your handler or the terminal:

coss inboxes threads <inbox>
coss inboxes thread <inbox> <thread>
coss inboxes reply <inbox> <message> --text "On it."

The reply joins the thread with its own status, though it never reaches your mail client. A second test email with the same subject and sender joins the thread too, as an answer would (threading).

const { :  } = await ...(, );
for (const  of ?. ?? []) {
  .(., ., .);
}

Verdicts

Put a marker in a test email's subject to try what your agent does with suspicious mail:

[coss-test:spf-fail], [coss-test:dkim-fail] and [coss-test:dmarc-fail] set the authentication verdicts of the received email.

Just the webhook

coss trigger sends a sample event, for working on a handler without any mail. Its ids are made up, so pass real ones if your handler reads the thread:

coss trigger inbox.message.received -F inbox_id=<inbox> -F thread_id=<thread> -F message_id=<message>

Last updated