A broadcast sends real email to real people as soon as it is sent. There is no test mode. So this skill only ever produces a draft, and a person presses Send or Schedule.
Ask first
- Which group? The customer group by name. If it doesn't exist, ask whether to create it and who goes in it. Don't guess members.
- Subject and message. The words, or what the email should say if the AI is to write it.
- From which address? One of the business's email accounts.
- When should it go? Only so the person knows the next step. The AI never sets the time.
Steps
1. Customers & Benefits: the group
Find the customer group (customer_group) by name. The broadcast addresses the group by its record id (sk).
A static group holds the contacts listed on it (contacts) and the contacts whose own groups field names it. A smart group (groupType dynamic) holds whoever its rules match, and nobody is added to it by hand (see Broadcast audience from a filter). If members need adding to a static group, use call_appengine POST /crm/customer-groups/members with { "customerIds": [<contact sks>], "add": ["<group sk>"] }. That is what Contacts → Add to Group calls: it adds them to the group's list and puts the group's name in each contact's groups, keeping their other groups. If any member is not someone the person named, stop and ask.
Hands on: the group's sk.
Check: open it (/customers-benefits?view=groups&groupId=<sk>) and confirm it is the right group.
2. Email Accounts: the sender
Find the email account (email_account) it should come from.
Hands on: the account's sk. Check: the account exists. If the business has no sending account, the draft can still be saved, but it cannot be sent until one is added in Email Accounts. Say so.
3. Broadcast: the draft
Create an email_broadcast record. Saving one is a plain record create, the same write as the composer's Save Draft button. Set exactly these fields:
| Field | Value |
|---|---|
name | the campaign's name |
channel | email |
subject | the subject line |
content | the message (HTML). For personal fields, insert them the way the composer's Personalize button does ({{data.<namespace>.<field>}}). Don't make up placeholder names. |
senderAccounts | [<email account sk>] |
recipientMethod | lists |
selectedLists | [<customer group sk>] |
status | draft |
Never set status to pending or scheduled, and never add a schedule. A sweep every five minutes sends anything pending or due. Never use the list all-contacts: it is everyone. Never call POST broadcast/<id>/send.
Count the audience with POST broadcast/audience/count and { lists: [<group sk>] }. The count resolves the group the way a send would: members listed on the group plus customers whose groups name it (for a smart group, whoever its rules match), minus anyone who has unsubscribed, bounced or complained.
Hands on: the broadcast's sk and the audience count.
Check: read the record back. status is draft, selectedLists holds the group's sk, and there is no schedule.
4. Show it
Open it in the composer: Broadcast with ?openId=<broadcast sk> (/broadcast?openId=<sk>). It is also in the broadcasts list marked draft.
Stop: sending or scheduling is the person's decision. Show:
- the subject;
- the first lines of the message;
- the sender;
- the group and how many people it will reach.
To send, they press Settings & Send → Send Now in the composer themselves, or add a time under Settings & Send → Schedule → Add schedule. If they say "send it" in chat, repeat the audience count and the sender, and send only after a clear yes. Bulk email also needs the business's bulk-email agreement. Without it the send is refused.
Every email gets an unsubscribe footer automatically, so the AI doesn't add one.
When it's done
Tell the person:
- the draft's name and subject;
- the group and its audience count (and how many were left out as unsubscribed or bounced, if asked);
- the sender address.
Then say that nothing has been sent and that it is waiting in Broadcast under draft.
Don'ts
- Don't state facts in the message that the person didn't give you: how a discount is claimed, codes, dates, prices, "already applied to your account". Write what they said, and leave a clearly marked gap (e.g. [how to use the discount]) for anything they didn't.