Skip to main content

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​

  1. In the app, open the account menu at the bottom of the sidebar and choose Create company. Name it something you can't mistake for production, such as "Acme (staging)". You don't need a second sign-up: the same login can hold several companies.
  2. Pick the Free plan. It's enough for staging and CI, and it never charges a card.
  3. Invite your colleagues to it from Settings → Members. Anyone who belongs to more than one company switches between them from the same account menu.
  4. In the staging company, open Settings → API keys and create a key. Name it after where it runs, such as "Staging" or "CI".
  5. 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.