API Reference
Add Automation Step
POST /automations/:id/steps — append a step to a disabled automation.
POST
/automations/:id/stepsAppends a step to an automation. The automation must be disabled — stop or disable it first. Returns the created step.
Supported step types (see the Steps page for full config shapes):
- [send_email](/docs/automations/send-email) — send a published template;
config.template.idis required, with optionalvariables,from,subject, andreply_to. - [delay](/docs/automations/delay) — pause for a natural-language
duration(e.g."1 day"). Maximum 30 days. - [wait_for_event](/docs/automations/wait-for-event) — pause until
event_nameis received, with an optionaltimeoutandfilter_rule. - [condition](/docs/automations/condition) — branch on a
rule(or anand/orgroup of rules) evaluated againstevent.*/contact.*data. - [contact_update](/docs/automations/contact-update) — update the contact's
first_name,last_name,unsubscribed, orproperties. - [contact_delete](/docs/automations/contact-delete) — delete the contact;
configis an empty object{}. - [add_to_segment](/docs/automations/add-to-segment) — add the contact to a segment; requires
config.segment_id.
Add a delay step
import { Mailblastr } from 'mailblastr';
const mb = new Mailblastr('mb_xxxxxxxxx');
const { data, error } = await mb.automations.addStep('c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd', { "type": "delay", "config": { "duration": "1 day" } });
console.log({ data, error });Add a send_email step
import { Mailblastr } from 'mailblastr';
const mb = new Mailblastr('mb_xxxxxxxxx');
const { data, error } = await mb.automations.addStep('c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd', {
"type": "send_email",
"key": "welcome",
"config": { "template": { "id": "34a080c9-b17d-4187-ad80-5af20266e535" } }
});
console.log({ data, error });Response
The step routes return the stored step row rather than the documented graph shape, so the response uses the internal step vocabulary: send_email is stored as send and wait_for_event as wait, and a send_email config is flattened to { from, subject, html, text, template_id, variables?, reply_to? } (so template.id comes back as template_id). The documented send_email / template shape is what the automation-level create, retrieve and update responses return.
{
"id": "9a8b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d",
"key": "welcome",
"type": "send",
"position": 0,
"config": { "template_id": "34a080c9-b17d-4187-ad80-5af20266e535" }
}