Use a separate Tenant for staging and CI
There is no test mode. Every Event you record is real, in the Tenant the key belongs to, and Throughline acts on it: an Event can enrol a Contact in a live Journey, and that Journey sends a real email or SMS to a real person. A test suite that records trial_started for a seeded Contact whose address happens to be a customer's will email that customer, and there is no undo.
So create a second Tenant, such as "Acme (staging)", with its own API key, and point staging, CI and every developer machine at it. Only production uses the production Tenant's key.
# production
THROUGHLINE_CLIENT_ID=… # production Tenant
THROUGHLINE_CLIENT_SECRET=…
# staging, CI, development
THROUGHLINE_CLIENT_ID=… # staging Tenant: a different Tenant, not a different mode
THROUGHLINE_CLIENT_SECRET=…
The two keys look alike because they are the same kind of key. Only the Tenant behind them differs, and nothing about the key will warn you when you mix them up.
Setting it up
- Sign up a second company for staging, with an email address of its own. The company is your staging Tenant.
- Invite your colleagues to it from Settings → Members. Anyone who belongs to both companies picks one when they sign in.
- In the staging company, open Settings → API keys and create a key. Name it after where it runs, such as "Staging" or "CI".
- Put its ClientID and secret in your staging and CI environments.
Build and test your Journeys in the staging Tenant too, so the Events your tests record have something real to trigger, and send only to addresses your team owns.