Connect your app's users

Your app keeps its users in a Firestore collection of its own. Point Arc CMS at it, and Arc CMS can email those people, group them in live lists and start sequences when their data changes, while the data stays where it is.

This page is the walk-through. What each screen does, what is stored and who can use it are in App audience.

Which case is yours

Your users areConfigure with
In another app's collection, in the same Firebase project (the usual case)--app-users-database and --app-users-path. Arc CMS then runs in its own database: set that up first with Share a Firebase project.
This install's own users (people who sign up to your Arc CMS app)--app-users=own. See Your own Arc CMS users.

What Arc CMS keeps. The people in your collection are not Arc CMS users: they get no users record and never sign in to Arc CMS. Arc CMS stores only its own facts about each of them (email consent and sequence progress) in AppAudience, under a hash of their unique key. No profile data is copied.

Check that your collection fits

Connect it

  1. Point Arc CMS at the collection. The database is almost always (default); the path is the collection and a wildcard, exactly <collection>/{id}:

    npm run arc:configure -- --project=default --app-users-database='(default)' --app-users-path='users/{id}'

    This writes ARC_APP_USERS_DATABASE and ARC_APP_USERS_PATH into functions/.env.{projectId}. Add --dry-run to see the changes first. If you set the project up with the guided npm run deploy and named the other app's collection there, this is already done.

  2. Deploy the functions. The trigger that watches your collection is bound when it is deployed, so a changed path always needs a deploy:

    npm run deploy -- --only functions --project default
  3. Tell Arc CMS how to read a person in Settings, App audience. The top shows the database and collection you deployed. Then choose:

    SettingChoose
    Unique keyThe document id, or the field that identifies one person
    Email field, Phone field, Name fieldThe fields that hold them. Fields are offered from a sample of real documents; nested ones are written as dot paths such as profile.name.
    Watch for changesThe fields whose changes should start something, such as isPro or plan.tier. Leave out counters and timestamps: they change all the time and mean nothing.

    Use "Test with a document" to see one person as Arc CMS reads them, then Save. This needs no deploy and can change at any time.

  4. Check the connection. Audience, App users lists your people with their names and addresses. Open one, change a watched field in your app (or in the Firebase console), and the change appears under their recent activity.

Fields whose names look like credentials (password, token, secret, otp, pin and the like) show as (hidden) and never reach an email or an event. If your app keeps a secret under an ordinary name, rename it in your app.

Email people when something changes

Settings, Automations lists the events your collection produces:

EventWhen
app_user.createdA new document appears (not those that existed before the deploy)
app_user.changed.<field>A watched field changes, with its old and new value
app_user.deletedA document is deleted
  1. Create the email template first. It can use the person's own fields as ##APP.<field>##, with a fallback after a bar: ##APP.plan.tier|free##. All tags are in Email merge tags.

  2. In Settings, Automations, switch the event on and add a rule: a name, for a field change an optional condition on the old and the new value, and the email to send (transactional reaches everyone; marketing respects unsubscribes).

  3. Change the field in your app and check the person's recent activity and Email Logs.

Values compare as text, ignoring case, and a missing field counts as empty: isPro becoming true is "becomes exactly true". These rules only send emails; the people are not contacts, so rules never add them to ordinary lists.

Group them and send to them

"isPro is false" does not match a person who has no isPro field at all. For everyone who is not on the plan, use "isPro is not true".

Unsubscribing: everyone starts subscribed. The unsubscribe link and the preferences page record the choice in AppAudience and end their sequences; it shows in Audience, App users.

Your own Arc CMS users

An app built on Arc CMS, with people signing up to it, can use the same live lists, automations and sequences over its own users. A project set up with the guided npm run deploy as "Only by Arc CMS" already has this; otherwise run:

npm run arc:configure -- --project=default --app-users=own
npm run deploy -- --only functions --project default

What the other app does

Nothing changes in it. Tell its developers:

Changing things later

ChangeWhat to do
Unique key, email, phone or name field, watched fieldsSettings, App audience. No deploy.
The collection or its databaseRun npm run arc:configure with the new --app-users-path or --app-users-database, then deploy the functions.
Your app's database was deleted and created againThe trigger stays bound to the old one and never fires. Delete arccms-onAppUserWritten, then deploy it again: an update does not rebind it. For the Arc CMS database, see Share a Firebase project.