Skip to content

Campaigns ​

These tools build and manage email campaigns: create a campaign with its content in one step, change its subject or audience, add variants for specific segments or tags, copy it, or delete it. Campaigns are always created as drafts, and these tools never send or schedule anything.

For a step-by-step flow, use the Create an email campaign workflow.

How a campaign is built ​

A campaign in Rule is made of four linked parts:

Campaign        name, audience (tags and segments), sendout type, labels
└── Message     subject, preview text, sender
    └── Variant (dynamic set)
        │       the default content, or content for one tag or segment
        └── Template    the email's content and layout
  • A campaign has one message.
  • A message has one default variant, shown to everyone, and can have more variants, each shown only to subscribers in a chosen tag or segment (its trigger). In the API, variants are called dynamic sets.
  • Each variant has its own template: the email content itself. See Email templates.

Which tool to use ​

You want to…Use
Create a new campaign with its emailcreate-campaign
See a campaign, its audience and its emailget-campaign
Rename it, or change its audience or labelsupdate-campaign
Change the subject, preview text or senderupdate-message
Add a variant for a segment or tagcreate-dynamic-set
Change or switch off a variantupdate-dynamic-set
Duplicate a campaign, in the same or another accountcopy-campaign
Delete a campaign, its message or one variantdelete-campaign, delete-message, delete-dynamic-set
Change the email's contentget-email-template and update-email-template
See what the email looks likepreview-email-template

Good to know ​

  • Drafts only. New campaigns are drafts. The name, sendout type and audience can only be changed while a campaign is a draft. The subject, sender and variants can be changed while it is a draft or scheduled. Labels can be changed at any time.
  • Email only. Content can only be created for email campaigns. create-campaign can create an empty SMS campaign, but its content has to be written in Rule.
  • Unsubscribe link. A marketing email must contain an unsubscribe link (a link to [Link:Unsubscribe]). Transactional emails do not need one.
  • Deleting is permanent and removes everything below: deleting a campaign also deletes its message, variants and templates.
  • No automatic clean-up. If a tool that creates several parts fails half-way, the parts already created are kept and listed in the answer, so you can see exactly what exists.
  • Every tool also takes the optional account_id (see Accounts). It is left out of the tables below.

Campaigns ​

list-campaigns ​

Lists the campaigns in an account with their id, name, status, message type and dates.

ParameterTypeRequiredDescription
message_typeemail, text_message or rcsNoOnly campaigns of this type. Leave out to list all.
pagenumberNoPage number, starting at 1.
per_pagenumberNoCampaigns per page, from 3 to 100. Defaults to 100.
  • Rule can leave the last campaign off the last page. When that happens the answer says so, and the assistant asks again with a different page size to show it.
  • Labels are always empty in this list. Use get-campaign to see a campaign's labels.
  • The answer includes a link to the campaigns page in Rule.
  • To see what was sent on a particular day, use export-dispatchers instead.

Try asking: "List my draft campaigns."

get-campaign ​

Shows one campaign in full: its status, audience, labels and statistics, its message and, for campaigns made in Rule's current email editor, the default email's content.

ParameterTypeRequiredDescription
campaign_idnumberYesThe campaign's id.
  • Each tag and segment in the audience has a negative flag. When it is true, subscribers in that tag or segment are excluded.
  • A new draft without content has no message yet (message: null). That is normal.
  • For campaigns made in Rule's older email editor, the content cannot be read.
  • To show the email, use preview-email-template. The campaign's own preview_url only works for someone signed in to Rule.

Try asking: "Show me campaign 1234: who is it sent to, and what does the email say?"

create-campaign ​

Creates a draft campaign together with its message, its default variant and the email template, in one step.

ParameterTypeRequiredDescription
namestringYesCampaign name.
message_typeemail or text_messageYesEmail or SMS. RCS is not supported.
templateobjectYesWhere the content comes from. See Content below.
sendout_typemarketing or transactionalNoDefaults to marketing.
recipientsobjectNoThe audience: { tag_ids, segment_ids }. List an id to include it, or { id, negative: true } to exclude it. Leave out to add the audience later.
skip_missing_recipient_idsbooleanNoGo on without tags or segments that do not exist. See the note below.
label_idsarray of numbersNoLabels to add.
subjectstringNoEmail subject line.
pre_headerstringNoPreview text shown after the subject in the inbox.
senderobjectNo{ name, email, phone_number }, each optional.

Content of a new campaign ​

  • New content ({ mode: "inline", content, name, brand_style_id }): the email is given as RCML in content and styled with the chosen brand style, or the account's default one. It is checked before anything is created, so invalid content creates nothing. Without content, the campaign gets a simple placeholder email to finish in Rule. For SMS, Rule's default content is used.
  • Copy of an existing template ({ mode: "reuse", template_id }): the template is copied, so later changes to the copy or the original do not affect each other. The template must be of the same type (email or SMS) as the campaign.

Notes ​

  • A tag or segment that does not exist stops the call before anything is created, and the answer names the ids. Create the missing tag or segment in Rule and try again. If you tell the assistant to go on without them, the ones that exist are used and a warning lists the others. If none of the ids in a list exist, or none of those to include, the call still stops.
  • For an email campaign, the answer includes a link that opens the campaign in Rule's editor.

Try asking: "Create a marketing email campaign called 'Spring sale' for the segment 'Newsletter subscribers', excluding the tag 'No offers', with a short announcement email."

update-campaign ​

Changes a campaign's name, sendout type, audience or labels. Only what you mention is changed.

ParameterTypeRequiredDescription
campaign_idnumberYesThe campaign's id.
namestringNoNew name.
sendout_typemarketing or transactionalNoNew sendout type.
recipientsobjectNo{ tag_ids, segment_ids }. A list you give replaces the current one; [] removes all. Leave a list out to keep it.
skip_missing_recipient_idsbooleanNoGo on without tags or segments that do not exist. See the note below.
label_idsarray of numbersNoReplaces all labels; [] removes all.
  • The name, sendout type and audience can only be changed while the campaign is a draft. For any other status the tool refuses, rather than appearing to succeed while Rule ignores the change.
  • A tag or segment that does not exist stops the call, and the campaign's audience stays as it was. If you tell the assistant to go on without them, the ones that exist replace the list and a warning lists the others. If none of the ids in a list exist, or none of those to include, the call still stops, so this can never empty a list; use [] for that.
  • Whether a campaign is email or SMS cannot be changed.

Try asking: "Rename campaign 1234 to 'Spring sale 2026' and add the VIP tag to its audience."

copy-campaign ​

Duplicates a campaign as a new draft, in the same account or in another account you have access to.

ParameterTypeRequiredDescription
campaign_idnumberYesThe campaign to copy.
new_namestringNoName of the copy. Defaults to <name> (copy) in the same account, and to the original name in another account.
source_account_idnumberNoTo copy to another account: the account to copy from. Give it together with target_account_id.
target_account_idnumberNoThe account to copy to.
target_brand_style_idnumberNoFor a copy to another account: the brand style to apply. Defaults to the brand style with the same name, otherwise the target account's default.
  • The copy is always a draft and fully independent: its message, variants and templates are new.
  • Labels are never copied.
  • To another account (email campaigns only): the audience is not copied, since tags and segments differ per account; set it on the copy afterwards. Images are copied to the target account, and tags, segments and custom fields used inside the email are matched by name. A variant whose tag or segment has no match is copied without its condition, and is usually switched off by Rule; set its condition in Rule. A variant that Rule switched off because another active variant already uses the same tag or segment is reported too.
  • Everything that could not be copied exactly is listed in warnings.

Try asking: "Copy campaign 1234 from my Swedish account to my Norwegian account."

delete-campaign ​

Permanently deletes a campaign together with its message, variants and templates.

ParameterTypeRequiredDescription
campaign_idnumberYesThe campaign's id.
  • This cannot be undone.
  • Not possible while the campaign is sent, sending, scheduled or pausing.

Try asking: "Delete the draft campaign 'Test campaign'."

Messages ​

get-message ​

Shows a campaign's message: subject, preview text, sender, the default email's content, and the list of its variants.

ParameterTypeRequiredDescription
message_idnumberYesThe message's id, shown by get-campaign.
  • Each variant is listed with its id, trigger, name, position, whether it is active, and its template_id. Read a variant's content with get-email-template.
  • For messages made in Rule's older email editor, variants are not listed.

Try asking: "What variants does campaign 1234 have?"

create-message ​

Adds a message to a campaign that has none, for example when creating a campaign stopped half-way.

ParameterTypeRequiredDescription
campaign_idnumberYesThe campaign to add the message to.
subjectstringNoSubject line.
pre_headerstringNoPreview text.
senderobjectNo{ name, email, phone_number }. Defaults to the account's sender.
  • Only for draft email campaigns made in Rule's current editor that have no message yet.
  • Rule renames a campaign after the message's subject when the message is created. The tool puts the campaign's name back, and warns you if that fails.
  • Then add content with create-dynamic-set.

Try asking: "Add a message with the subject 'Our spring offers' to campaign 1234."

update-message ​

Changes the subject, preview text or sender. Only what you mention is changed.

ParameterTypeRequiredDescription
message_idnumberYesThe message's id.
subjectstringNoNew subject. It can be replaced, but not removed.
pre_headerstringNoNew preview text.
senderobjectNo{ name, email, phone_number }. Only the parts you give are changed.
  • Only while the campaign is a draft or scheduled.
  • For an email campaign, Rule keeps the campaign's name equal to the subject: changing the subject also renames the campaign. A different name set with update-campaign is replaced the next time the subject changes.

Try asking: "Change the subject of campaign 1234 to 'Last chance: spring sale'."

delete-message ​

Permanently deletes a message with all its variants and templates. The campaign stays, without content, until you add a new message.

ParameterTypeRequiredDescription
message_idnumberYesThe message's id.
  • This cannot be undone.
  • Not possible while the campaign is sending, scheduled or pausing.

Try asking: "Delete the message of campaign 1234 so I can start over."

Variants ​

In the API, variants are called dynamic sets. A variant without a trigger is the message's default content.

Who gets which variant. The variants are in order, with the default last. When the campaign is sent, each subscriber gets the first active variant they match; anyone who matches none gets the default. So if a subscriber can be in several of the chosen tags or segments, the order decides which email they get.

get-dynamic-set ​

Shows one variant: its trigger, name, whether it is active, its own subject, preview text and sender if they differ from the message, and its template_id.

ParameterTypeRequiredDescription
dynamic_set_idnumberYesThe variant's id, shown by get-message.
  • The default variant has no trigger.
  • The email content is not included; read it with get-email-template and the template_id.

Try asking: "Which segment sees variant 91011, and is it active?"

create-dynamic-set ​

Adds content to a message: the default variant, or a variant for one tag or segment.

ParameterTypeRequiredDescription
message_idnumberYesThe message's id. Email messages only.
templateobjectYesNew content: { mode: "inline", name, template, brand_style_id } with the email as RCML. Or a copy of an existing template: { mode: "reuse", template_id }.
triggerobjectNo{ type: "segment" or "tag", id }: who sees this variant. Leave out to create the default.
namestringNoVariant name. Defaults to the name of its tag or segment.
positionnumberNoWhere to put the variant among the others, counting from 1 at the top. Defaults to after the existing variants. The default always stays last.
activebooleanNoWhether the variant is switched on. Defaults to true.
subjectstringNoA different subject for this variant only.
pre_headerstringNoDifferent preview text for this variant only.
senderobjectNoA different sender for this variant only.
  • Create the default first. A variant with a trigger can only be added once the message has a default.
  • Normally, all variants share the message's subject, preview text and sender. Give them here only when this variant should differ.
  • New content is checked and styled the same way as in create-email-template.
  • Same tag or segment twice: if another active variant already uses the same tag or segment, Rule creates the new one switched off, since only the first would ever be sent. The answer tells you which variant already uses it.

Try asking: "Add a variant for the 'VIP customers' segment to campaign 1234, with a shorter email and a discount code."

update-dynamic-set ​

Changes a variant. Only what you mention is changed.

ParameterTypeRequiredDescription
dynamic_set_idnumberYesThe variant's id.
message_idnumberYesThe message the variant belongs to. Used to check the change against the other variants.
namestringNoNew name.
triggerobject or nullNo{ type: "segment" or "tag", id } to change who sees it. null makes it the default.
activebooleanNoSwitch the variant on or off.
positionnumberNoMove the variant, counting from 1 at the top. The default always stays last.
subjectstringNoA subject for this variant only.
pre_headerstringNoPreview text for this variant only.
senderobjectNoA sender for this variant only.
utm_campaign, utm_termstring or nullNoTracking values for this variant's links. null removes one.
template_idnumber or nullNoUse another existing email template, or null to remove the content.
  • The tool refuses a change that would leave subscribers who match no variant without an email: giving the default a trigger, or switching it off, while other variants remain.
  • Two active variants may use the same tag or segment, but only the first one is ever sent. The assistant points this out and lets you choose.
  • After a change of trigger or order, the tool checks that the default is still last, and tells you how to fix it if not.
  • Changing template_id deletes the previous template. If another variant used the same template, that variant loses its content; the answer warns you. To use new content, create it first with create-email-template.
  • Make sure message_id is right: the tool cannot detect a wrong one.
  • Only while the campaign is a draft or scheduled.

Try asking: "Switch off the variant for the 'VIP customers' segment."

delete-dynamic-set ​

Permanently deletes one variant and its template.

ParameterTypeRequiredDescription
dynamic_set_idnumberYesThe variant's id.
message_idnumberYesThe message the variant belongs to.
  • This cannot be undone. The assistant tells you which template is deleted with it.
  • The tool refuses if the variant does not belong to the given message.
  • Rule allows deleting the default or the last variant. The tool does not block this, but warns you about what is left: a message with no content (it cannot be scheduled), variants without a default (subscribers who match none get nothing), or a variant left in the default's place.
  • For a campaign, not possible while it is sending, scheduled or pausing. A sent campaign's variant can be deleted. Variants of automation emails can be deleted at any time, even while the automation is active.

Try asking: "Remove the 'VIP customers' variant from campaign 1234."