The ef CLI can build audiences from a SegQL query and run email and SMS campaigns to them. It calls the same API as the app, so the same permissions, consent rules, suppressions and quiet hours apply. Nothing here can switch them off.
Before you start
- Connect the CLI to your project: Connect the ef CLI.
- These commands need
ef 0.24.0 or later. Check with ef --version. If ef audiences is not listed in ef --help, update with npm i -g @elasticfunnels/cli@latest; if it is still missing after that, the release is not out yet.
- Audiences need the analytics permission and the segment permissions. Campaigns need the email permissions, and SMS needs the SMS integration permissions.
- Contact details in samples and recipient lists come back masked (
j***@g***.com, ***0123) unless your role has See unmasked on the Contact details row (see who sees emails and phone numbers).
ef claude installs two skills for Claude Code: ef-segql (how to write audiences) and ef-campaigns (how to send safely).
Audiences
Write the query in a file, check it, count it, then save it.
An example query, buyers who skipped every upsell in the last 30 days:
A misspelled column is an error, but a value that does not exist (an event name, a product code) just matches nobody. When count says 0, check the values before you save.
Use IDENTIFY BY email for any audience you plan to email or text.
Email campaigns
- Audience:
--audience <id>, --all-customers, --emails a@example.com,b@example.com, --emails-file list.txt or --crm-entity <id>.
- Who is left out:
audience-preview shows how many people will receive it and how many are excluded as suppressed (bounced, complained, unsubscribed), without consent (recorded as “no” at opt-in) or duplicates.
- Test first: launch refuses until a test was sent. Tests go to one address and never touch the audience.
- Confirmation:
launch and schedule print the number of people who will receive it and stop. Run them again with --yes to send. In a terminal you can type the confirmation instead.
ef campaigns email get 17 lists anything that still blocks sending, such as a missing sending account or marketing address.
unschedule puts a scheduled campaign back to draft. cancel stops one that is scheduled or sending.
SMS campaigns
--audience and --exclude take audience ids. --exclude-regions US-FL,US-OK skips those places.
- The opt-out footer (“Reply STOP to opt out”) is added to every marketing text. A custom
--footer must contain STOP.
- The SMS test goes through your SMS provider, so it costs one message.
- Quiet hours and the frequency cap from SMS campaigns apply to every send.
Output for scripts and agents
Commands that print data take --json; get always prints JSON. Errors exit with a non-zero code: 2 for a SegQL or validation error, 3 for a permission problem, 4 for a conflict (for example editing a campaign that is no longer a draft), 7 when something is not found.