Agent Wranglers

NTF-8Required

Never contact customers from test systems

Outside production, deliver email, texts and push only to an allow list of test domains, phone numbers and devices. Drop every other recipient before the provider call.

How to do it

Staging can hold customer addresses, phone numbers and push tokens by mistake, and one test job can mail thousands of people or wake their phones. Set the transport per environment. In development and staging, point email at a local capture server, such as Mailpit, or a sandbox mode of your sending service. Use the provider's test credentials or a local fake sender for texts and push. Give production the only live provider credentials. Keep a short allow list of team test domains, numbers and device tokens, and filter in one function every channel calls. Keep customer contact data out of test data, as masked copies explains. Payment providers have their own test mode, as Keep test and live modes apart says.

Examples

JavaScript example

const TEST_DOMAINS = new Set(['example.org']);
const TEST_RECIPIENTS = new Set(['+46700000001', 'device-token-test-1']);

export function allowedRecipient(environment, recipient) {
  if (environment === 'production') return true;
  const domain = recipient.includes('@') ? recipient.split('@').pop().toLowerCase() : null;
  return domain ? TEST_DOMAINS.has(domain) : TEST_RECIPIENTS.has(recipient);
}

Python example

TEST_DOMAINS = {"example.org"}
TEST_RECIPIENTS = {"+46700000001", "device-token-test-1"}

def allowed_recipient(environment: str, recipient: str) -> bool:
    if environment == "production":
        return True
    if "@" in recipient:
        return recipient.rsplit("@", 1)[-1].lower() in TEST_DOMAINS
    return recipient in TEST_RECIPIENTS

How to check

A test starts the app with staging settings, then sends an email to someone@customer.example, a text to +46701234567 and a push to an unknown token. None reaches a provider, and the capture server holds the email. The staging environment holds no live provider key.

Sources

For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/notifications/channels-and-preferences/test-notification-sinks">Agent Wranglers notifications playbook</a>. In code you write, add a comment next to it with the same link.