Automations
An automation is a template: a tree of steps drawn in the app (a
trigger, messages with buttons, waits, conditions, actions). It carries no
trigger word, no publication and no value. What runs is a pose of it on
one publication: that publication’s trigger words, and one value per
{variable} of the template. See
Comment → DM automations for what the
person on the other end experiences.
These endpoints do not exist in the original project. They are Instagram-only.
Endpoints
Section titled “Endpoints”GET /automation-flows the templatesPOST /automation-flows create oneGET /automation-flows/{id}PUT /automation-flows/{id} name, channel, definitionPUT /automation-flows/{id}/status DRAFT, ACTIVE or PAUSEDDELETE /automation-flows/{id}GET /automation-flows/{id}/poses where it is posedPOST /automation-flows/{id}/poses pose it on something already liveGET /automation-flow-poses?integrationId=&mediaId= what runs on a channel, or on one publicationGET /automation-flow-poses/{id}PUT /automation-flow-poses/{id} words, values, pauseDELETE /automation-flow-poses/{id}GET /automation-flow-poses/{id}/runs the peoplePOST /automation-flow-poses/{id}/poll read the comments nowPOST /automation-flow-poses/{id}/replay run on named commentsPOST /automation-flows/email-preview render a Brevo step's emailPOST /automation-flows/email-test send yourself that emailTemplates
Section titled “Templates”GET /automation-flows lists them with status (only ACTIVE ones run),
issues (what blocks activation: level error, or a warning), and
_count (poses, runs). POST (201) takes name (1 to 120 characters),
integrationId (the Instagram channel the DMs go out from, nullable) and
definition — the tree, whose shape is the one the editor writes; the server
strips any words, publications or values it carries, since those belong to a
pose. PUT /automation-flows/{id} takes the same three fields, each optional.
PUT /automation-flows/{id}/status with { "status": "ACTIVE" } is refused
(400) while the template has an error.
Posing on a post you schedule
Section titled “Posing on a post you schedule”A post that has not published yet has no Instagram media ID, so there is nothing to pose on. Pass the template in the post’s Instagram settings on Create a post instead, and the pose is created the moment the post goes live:
"settings": { "post_type": "post", "automationFlowId": "<template id>", "automationKeywords": ["LIEN", "LEIN", "LIENS"], "automationVariables": { "ressource": "le guide Malte", "bouton": "Le guide", "lien": "https://…" }}Posing on something already live
Section titled “Posing on something already live”POST /automation-flows/{id}/poses
| Field | Type | Required | Description |
|---|---|---|---|
integrationId |
string |
Yes | The Instagram channel |
mediaId |
string |
Yes | The post ID, or the story ID |
kind |
string |
No | post (default: the template’s trigger) or story |
keywords |
string[] |
Per template | The trigger words of this publication, 30 at most (a story reply needs none) |
variables |
object |
Per template | One value per {variable} of the template |
A template is posed once per publication. The response (201) is the pose.
What runs
Section titled “What runs”GET /automation-flow-poses?integrationId= lists the poses of a channel;
add mediaId= for one publication. Each pose carries its flow (id,
name, status), its mediaId and source (post_comment or
story_reply: what starts it), postId (the UseNadia post, when it came from
the composer), its keywords, variables, active, and counts (runs,
waiting, done, failed, emails).
PUT /automation-flow-poses/{id} changes keywords (30 at most),
variables or active (false pauses this pose alone; the template’s status
is the switch of them all). People already in the flow keep the tree they
started on.
The people
Section titled “The people”GET /automation-flow-poses/{id}/runs?status= — one row per person, with
their username, the keyword they used, their email once they gave it,
and a status. It is what the app’s Export CSV writes, for an
integration that collects the emails without Brevo:
| Status | Meaning |
|---|---|
PENDING |
Matched, the first step not sent yet |
WAITING |
At a « wait for the answer » step |
DELAYED |
In a delay |
DONE |
Reached the end |
HANDED_OFF |
Handed to a human (the inbox shows it) |
FAILED |
error carries Meta’s message. Never retried by itself |
SKIPPED |
Ignored: once per person, own comment, a reply… |
Poll and replay
Section titled “Poll and replay”POST /automation-flow-poses/{id}/poll reads the publication’s comments now
and starts what a missed webhook left behind ({ checked, started }).
POST /automation-flow-poses/{id}/replay runs the automation on comments
named by ID (commentIds, 1 to 50; resend restarts one that already
has a run), whatever their date. One outcome per comment: started, or why
not (not_on_post, already_has_a_run, no_keyword, once_per_user,
is_a_reply, own_comment, no_author, outside_meta_7_day_window,
pose_has_errors).
Previewing the email
Section titled “Previewing the email”A Brevo step sends a template of your organization’s Brevo connection. Before anyone receives it:
POST /automation-flows/email-previewrenders it with a run’s values, without sending anything. The answer (201) carriestemplateId,templateName,active(whether Brevo has the template active), the renderedsubjectandhtml, the template’ssender(name, email) andparams, the values it was rendered with (LINK,RESOURCE,KEYWORD,USERNAME).POST /automation-flows/email-testactually sends it, to one address, and answers{ "sent": true, "to": "…" }.
| Field | Type | Required | Description |
|---|---|---|---|
brevoTemplateId |
number |
Yes | |
dmLinkUrl |
string ≤ 2,000 |
No | The link the DM gave |
resourceName |
string ≤ 200 |
No | The name of the resource |
keyword |
string ≤ 100 |
No | The trigger word |
username |
string ≤ 100 |
No | The person |
to |
string ≤ 320 |
Yes on the API (email-test) |
Where to send the test |
Without a Brevo connection, both routes return 400.