Skip to content

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.

GET /automation-flows the templates
POST /automation-flows create one
GET /automation-flows/{id}
PUT /automation-flows/{id} name, channel, definition
PUT /automation-flows/{id}/status DRAFT, ACTIVE or PAUSED
DELETE /automation-flows/{id}
GET /automation-flows/{id}/poses where it is posed
POST /automation-flows/{id}/poses pose it on something already live
GET /automation-flow-poses?integrationId=&mediaId= what runs on a channel, or on one publication
GET /automation-flow-poses/{id}
PUT /automation-flow-poses/{id} words, values, pause
DELETE /automation-flow-poses/{id}
GET /automation-flow-poses/{id}/runs the people
POST /automation-flow-poses/{id}/poll read the comments now
POST /automation-flow-poses/{id}/replay run on named comments
POST /automation-flows/email-preview render a Brevo step's email
POST /automation-flows/email-test send yourself that email

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.

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://…" }
}

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.

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.

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…

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).

A Brevo step sends a template of your organization’s Brevo connection. Before anyone receives it:

  • POST /automation-flows/email-preview renders it with a run’s values, without sending anything. The answer (201) carries templateId, templateName, active (whether Brevo has the template active), the rendered subject and html, the template’s sender (name, email) and params, the values it was rendered with (LINK, RESOURCE, KEYWORD, USERNAME).
  • POST /automation-flows/email-test actually 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.