Workflows
What happens after an event. A workflow waits, checks whether it is still worth acting, and then acts — which is the whole product in one sentence.
Owners only
Creating a workflow, drafting one from a description, publishing a version and enabling, disabling or renaming one need the owner role — each of them changes what gets sent to customers automatically. Anyone in the workspace can read workflows and their runs.
The dashboard builds these for you - Workflows, then New workflow - from recipes such as order confirmations and abandoned carts. This page is the same thing through the API.
The WhatsApp recipe list also includes Hand a purchase conversation to the AI, Send an AI-written purchase follow-up, and Follow up, then hand to the AI. They start on purchase.intent and check whether the customer has opted out or ordered. Follow-ups wait five minutes and inherit the conversation account; they still require an open messaging window. Handoffs allow ten replies over one day and wait for new customer messages, without sending an opener. Their order, human-help and timeout branches end the run; human-help also creates a workspace alert. You can edit these steps and connect notification steps before saving.
Drafting one from a description
The dashboard uses background drafting. Owners submit POST /v1/workflows/draft-jobs with wanted (10 to 1,000 characters) and a unique UUID requestId. The response is HTTP 202 with a job ID and status. Reuse the same request ID when retrying an uncertain submission; changing its description is refused. Only one draft can be queued or running per workspace.
GET /v1/workflows/draft-jobs returns { job: ... } for the latest job, or{ job: null }. GET /v1/workflows/draft-jobs/{id} reads one job. These endpoints are owners only. Status is queued, running,completed or failed. Completed jobs carry the saved result; failed jobs carry an error. Polling and reopening a result do not call the AI.
GET /v1/workflows/draft-jobs/history?page=0 lists ten summaries per page with items and hasMore. Older paid results stay accessible when a newer job exists.
Credit is held while drafting and charged in the same transaction that stores the completed result. Failures release all holds, including correction attempts. A worker interrupted for 30 minutes is marked failed and its holds released, not automatically retried. A draft never enables a workflow.
WhatsApp and Instagram free-text replies
In a Send a message step, choose A message you write to send free text on WhatsApp or Instagram. WhatsApp free-text messages require an existing conversation on the selected account and an open 24-hour reply window. Outside that window, choose an approved WhatsApp template instead.
Instagram recipes answer story replies, ice breakers and referrals with plain text, not WhatsApp templates. Replies inherit the exact account from the triggering event. A specific connected account can be selected instead, but that customer must already have a conversation on it. Default means the default WhatsApp account, never the most recently active thread.
Plain text is limited to 1,000 characters. Automated replies require an open messaging window; waits totalling 24 hours or more show a warning. A new customer message can reopen the window. Human handover also pauses automated sends.
Refusals appear in run history and workspace alerts. They are recorded outcomes, not successful sends or a reason to retry the message automatically.
POST /v1/workflows/draft takes a sentence - { "wanted": "when someone asks about a product and does not buy, wait a day and send the follow up" } - and returns a definition wired up from what this workspace actually has: its triggers, its approved templates, the checks and actions below. It needs the AI assistant switched on, and it is owners only.
Nothing is switched on. The legacy synchronous endpoint may keep a disabled workflow. The response carries definition for you to review, create and enable yourself, problems naming anything still wrong with it, notes for whoever reads it, and - when none of your triggers fitted - newTrigger in the shape POST /v1/triggers takes. In the dashboard the draft opens on the canvas for review; saving and enabling remain explicit actions.
Triggers of your own
While a workflow AI handoff is actively handling a customer, AI conversation analysis does not emit new product.interest or purchase.intent events for that customer in the workspace. Message understanding and product tags still update. Once the handoff ends or expires, interest detection resumes. Explicit API or integration events are unaffected. A run waiting on an ordinary delay does not block new interests, including interest in different products.
Engentra notices four things by itself - a conversation starting, a message arriving, a conversation going quiet after a number of hours you set, a product being asked about - and it accepts any event your own systems send to POST /v1/events. Between those sits everything a business selling inside WhatsApp wants to act on, and nothing pushes it, because there is nothing to push from.
So you can write the condition instead. A trigger rule states something like “no message from them for 7 days”, “bought before but not in 90 days”, “asked about a product in the last 14 days and has not bought”, or “carries the tag vip”. Engentra checks every few minutes and records an event the first time each customer matches - once per occasion, not once per check - and your workflow starts on that event like any other.
Channel is a filter, not part of the rule
A customer who has gone quiet has gone quiet wherever they were. A rule watches every channel unless you narrow it, so the one you write today still means what you meant the day another channel is connected.
| Field | Type | Notes |
|---|---|---|
GET /v1/triggers | any member | The workspace’s saved triggers. |
POST /v1/triggers | owner | name, signal, optional channel, params. |
PUT /v1/triggers/{id} | owner | Everything but the event type. |
PATCH /v1/triggers/{id} | owner | Turn it on or off. |
DELETE /v1/triggers/{id} | owner | Events it recorded stay. |
The shape
A workflow is a trigger event type and a definition: a map of named steps, and which one starts. Here is the one the product exists for — chase a customer who asked a price and went quiet.
POST /v1/workflows
{
"name": "Chase the quiet ones",
"triggerEventType": "price.quoted",
"enabled": false,
"definition": {
"start": "wait",
"steps": {
"wait": { "type": "delay", "duration": "PT24H", "next": "replied" },
"replied": { "type": "condition",
"check": "customer.replied_since_trigger",
"then": "done", "else": "chase" },
"chase": { "type": "action", "action": "send_template",
"with": { "template": "follow_up", "language": "en_US" },
"next": "done" },
"done": { "type": "stop", "reason": "finished" }
}
}
}enabled is optional. Left out, the workflow is switched on the moment it is created; false saves it switched off until you turn it on with PATCH.
Five step types, and no more
| Field | Type | Notes |
|---|---|---|
delay | step | Waits. duration is ISO-8601 — PT2H, P3D. The run is parked in the database, not on a thread, so it survives a restart. |
condition | step | Branches on a named check. then and else both name a step. |
action | step | Does something. The actions are listed below. |
agent | step | Hands the conversation to the AI for a while, then continues one of three ways: ordered, person or timeout. See Handing the conversation to the AI. |
stop | step | Ends the run with a reason, which is recorded on its history. |
Conditions
Reply, opt-out and reply-window checks use the account selected under Account to check, not the most recently updated conversation. By default they use the triggering event account, or the default WhatsApp account when the event has none. Event account only refuses to guess when the event has no account. A specific account can be selected independently of a later send step; select matching accounts when checking whether that send is allowed. Opt-out checks use that account's platform, including Instagram. Order checks remain customer-wide.
The API accepts with.channelMode (inherit, default or specific) on condition steps andwith.channelId for a specific account. Missing or disconnected selected accounts stop the run rather than checking another account.
customer.replied_since_trigger did they write back after the event?
customer.opted_out have they unsubscribed?
conversation.within_window is their 24-hour window still open?
customer.ordered_since_trigger have they placed an order since?customer.ordered_since_trigger is what makes cart reminders safe: start the workflow on checkout.started, wait, and stop if an order.created has arrived for that customer since. The event that started the run never counts.
The first is the one that matters. Chasing somebody who already replied is worse than not chasing at all — it tells them nobody is reading.
The list is closed. A definition naming any other check is refused when you save it, with the valid names in the error, rather than being treated as false at run time — which would quietly send the follow-up.
conversation.within_window is false when the window has shut and when there is no conversation with the customer yet. It exists so a definition can branch on the window rather than finding out at send time. WhatsApp and Instagram free-text sends require an open window; an approved WhatsApp template can be used outside it.
Actions
send_template with: { template, language, variables }
send_message with: { text }
send_ai_message with: { brief, fallback }
record_event with: { type }
request_payment with: {}
create_campaign with: { name, template, variables, reuse, timing, timezone, sendTime, tag, scheduledAt }
notify_team with: { how, to, note, subject }Create a campaign from events
create_campaign creates or reuses a WhatsApp campaign. With reuse: daily, all runs of this workflow step share one campaign per collection date and audience tag. Choose per_run for one campaign per run, or once for one per tag. Retries never create another campaign for the same batch.
{
"type": "action", "action": "create_campaign",
"with": {
"name": "Daily reminders", "template": "daily_notice", "language": "en_US",
"variables": { "1": { "from": "customer.name", "fallback": "there" } },
"reuse": "daily", "timing": "next_day", "timezone": "Africa/Lagos",
"sendTime": "09:00"
},
"next": "done"
}Omit tag to use the tags supplied on the triggering event. Each distinct tag selects a separate campaign. An explicit tag selects that audience instead. Daily batching uses the event’s receipt date in the selected timezone. data.collectionDate is optional event data. Use a dated tag to isolate each day’s audience.
timing can be now, next_day or at. For at, supply scheduledAt with a UTC offset, up to 90 days ahead. A past explicit time fails rather than silently sending immediately. Next-day scheduling collects events throughout the day; starting now can close the audience before subsequent events arrive.
Recipients are selected once at execution, including tags added after scheduling. Later additions do not join a batch already started. Existing batch settings are not overwritten by later workflow runs; changed settings and closed batches produce a clear failure in run history. Reaching an already scheduled campaign leaves its original send time unchanged. Variables must use customer fields or fixed text, because the campaign has many triggering events. Tags remain on customers; SMS fallback and archived tag assignments are not part of this action.
request_payment asks for payment on the confirmed chat order that started the run. It uses the saved catalog total and currency, checks payment eligibility on the server, and reuses an existing payable link. Demo orders cannot create real payments. An unrelated event or an order for another customer cannot supply the order. The send still obeys channel permissions, template rules and payment send limits. The action queues durable work with the confirmed order; provider calls start after that transaction commits. A queued action does not prove the message was delivered.
send_message fills in named variables in your words. send_ai_message selects approved wording from your workspace knowledge. Set up AI-selected messages. Both are plain text and need an open messaging window, and both take the same channelMode as a template.
language defaults to en_US, as it does for a reply. variables fills the template's {{1}}, {{2}} slots, each from exactly one source:
"with": {
"template": "order_shipped",
"variables": {
"1": { "from": "customer.name", "fallback": "there" },
"2": { "from": "event.orderNumber" },
"3": { "text": "Lekki branch" }
}
}| Field | Type | Notes |
|---|---|---|
customer.name | from | Also customer.phone, customer.email and customer.externalId. |
event.<field> | from | A field of the data sent with the event that started the run. Dots reach nested fields: event.order.number. |
text | string | The same words every time. |
fallback | string | Used when a from value is missing or blank. |
A value that is missing with no fallback is not sent with a gap in it. The step is refused, and the run's history names the variable and the missing field. Line breaks and runs of spaces are flattened, because WhatsApp refuses them inside a variable - an address from a checkout form is where they usually come from.
A template with a website button whose link ends in a variable - a “Track order” button - needs one more key, "url", filled the same way: "url": { "from": "event.trackingNumber" }.
AI-selected messages
send_ai_message selects a published workspace knowledge answer that matches your brief. Turn on Send without review for an answer to make it eligible. Engentra sends the complete approved answer as written. Use send_template when an approved template needs explicitly mapped values.
{
"type": "action",
"action": "send_ai_message",
"with": {
"brief": "Thank the customer for contacting us and offer help.",
"fallback": "Still thinking it over? Reply here and we will help.",
"channelMode": "inherit"
},
"next": "wait"
}| Field | Type | Notes |
|---|---|---|
briefrequired | string | What this message is for, in your own words. Up to 500 characters. |
fallback | string | Sent exactly as written when an approved answer cannot be sent. Up to 1,000 characters. Optional, and worth having. |
channelMode | string | inherit (the default: the account the customer wrote on), default or specific with channelId - the same as send_message. |
The model receives your brief and matching Send without review answers. If it rewrites an answer, needs a person, or can no longer use an answer because approval changed, the step sends your configured fallback. The fallback also covers an unavailable assistant. Without a fallback, the run stops and records the refusal. An unsent draft is recorded in the workflow run when the model returned one.
Only inside the messaging window
It is plain text, so it reaches a customer only in a conversation they already have, within 24 hours of their last message - the same as send_message. Engentra checks that first: if the window is shut, a person is handling the conversation, or there is no conversation, the step is refused before the AI is asked. To reach somebody who has not written lately, send an approved template first.
The run's history records the exact words sent and who wrote them - "writtenBy": "ai" or "fallback", with the reason when the AI could not.
Handing the conversation to the AI
When drafting from a description, ask to “hand the conversation to the AI” for an ongoing agent step. Ask to “send an AI-selected message” for one immediate message. You can request both in sequence. An agent step waits for new customer messages; it does not send an opening message or answer the original trigger again. To start a follow-up after a wait, request an AI-selected message before the handoff.
An agent step lets the AI hold the conversation for a while: it answers the customer's messages itself, working towards a goal you set, then the run carries on by how it went. It is what turns “send a reminder” into “send a reminder, then help them buy”.
{
"start": "remind",
"steps": {
"remind": { "type": "action", "action": "send_template",
"with": { "template": "cart_reminder" }, "next": "agent" },
"agent": {
"type": "agent",
"goal": "Help them choose a size and complete their order",
"facts": "Code SAVE10 gives 10% off until Sunday",
"duration": "P1D",
"maxReplies": 10,
"ordered": "thanks",
"person": "tell_team",
"timeout": "done"
},
"thanks": { "type": "action", "action": "send_ai_message",
"with": { "brief": "Thank them for their order" }, "next": "done" },
"tell_team": { "type": "action", "action": "notify_team",
"with": { "how": "email", "to": "sales@example.com", "note": "A cart customer needs you" },
"next": "done" },
"done": { "type": "stop", "reason": "finished" }
}
}| Field | Type | Notes |
|---|---|---|
goalrequired | string | What the AI works towards. Up to 500 characters. |
facts | string | Extra things it may say for this workflow only, on top of your business facts and catalog - an offer code, a deadline. Up to 1,000 characters. It never offers a discount, price or date that is not written here or there. |
duration | string | How long it holds the conversation, PT1H to P7D. P1D when left out. |
maxReplies | number | The most replies it sends, 1 to 20. 10 when left out. |
orderedrequired | step | Where the run goes when the customer places an order - any order.created, from a store, your own system or a sale marked in the inbox. |
personrequired | step | Where it goes when a person is needed: the customer asked for one, a staff-only decision is needed, the AI could not safely answer after clarification, or somebody took over the conversation. Complaints alone do not take this branch. |
timeoutrequired | step | Where it goes when the time or the replies run out - or at once, when the AI cannot take part at all. |
While the step lasts:
- It only answers. The AI never writes first. After a template, it starts when the customer replies - which is also what reopens the 24-hour window.
- It answers alone, even with automatic replies off. You chose this for this workflow. Every other rule of an automatic reply still holds: it must be confident, grounded in your facts, catalog and the step's facts, and not require a person. Complaints can receive useful questions and verified answers. A reply that used business knowledge not marked Send without review is not sent.
- A person always wins. When anybody presses I'm handling this, the AI stops and the run takes the
personbranch. When a reply cannot go out for any reason, the same: the team gets the usual alert, the customer the usual “someone will reply shortly” message if you have it on, and the draft waits in the inbox. - Stopping early does not end it. A workflow's
cancelOn- stop when they send a message - would end it at the first reply it exists to answer, so a run waiting at an agent step is not stopped by it. An order still ends it, down theorderedbranch. - It reads what a reply reads: the customer's last week on every channel, their orders, your facts, catalog and published knowledge, plus the goal and facts above.
When the AI cannot take part
The step needs the AI assistant on and a plan with automatic replies. Without them it does not leave a customer in silence for a day: the run takes the timeout branch straight away, and its history says unavailable. If the AI becomes unavailable part-way, replies stop; the time limit then ends it the same way.
Each reply is marked AI in the thread. The run's history shows the step starting, when it ends, and how - ordered, person, reply_limit, timeout or unavailable - with how many replies it sent.
In the builder, both are a click away: Send a message → A message the AI writes, and Hand to the AI, whose card has its three ways out labelled Ordered, Needs a person and Timed out.
Stopping early
A condition step checks just before the step after it. cancelOn stops a waiting run the moment something happens, wherever it is and however many messages it had left:
{
"start": "wait",
"cancelOn": ["message.received", "order.created"],
"steps": { ... }
}When an event of one of those types is recorded for a customer, every run of this workflow waiting for that customer stops, and its history says which event stopped it. The run an event starts is never stopped by that same event - so a workflow that starts on checkout.started and also stops on it keeps only the newest cart's reminder. In the dashboard it is Stop early if: they send you a message, or they place an order.
One exception: a run waiting at an agent step is not stopped by these - the customer's messages are what the AI is there to answer. An order ends the agent step instead, down its ordered branch.
send_message sends plain text on both WhatsApp and Instagram into a conversation the customer already has on the selected account. In the dashboard, select A message you write in a Send a message step. WhatsApp does not require a template for these replies while the 24-hour reply window is open.
It cannot start a conversation. A customer with no thread on the selected account is a refusal with that as the reason. Automated free-text replies require an open 24-hour reply window. For WhatsApp messages outside that window, use send_template with an approved template instead. Instagram has no template alternative; a new customer message can reopen the reply window. A delay longer than a day will usually find the window shut. The run records why nothing was sent.
Put named variables directly in the text: {{customer.name|there}}, {{workspace.name}} or {{event.orderNumber}}. Customer fields are name, phone, email and externalId; workspace fields are name and businessCountry. Event fields come from this run's triggering event and support nested paths such as {{event.items.0.name}}. A literal fallback after | handles a missing value. Without a fallback, a missing value stops the send and creates a workflow alert. The filled message must fit within 1,000 characters. Numeric Meta slots such as {{1}} stay literal here; the separate variables map still belongs to approved templates.
record_event is how one workflow feeds another: the event it records can trigger a second workflow, which is how longer sequences are built without a step type for it. Subscribe to that event under Settings → Webhooks and your own systems receive it too - the same door, from the other side.
notify_team tells you rather than the customer. how is email or whatsapp, to is an address or an E.164 number, and note is whatever you want said; the customer's name and number are added for you. For email, subject is the subject line.
WhatsApp to your own team still needs a template
A message to somebody who has not written to you is business-initiated, and Meta asks for an approved template whether that somebody is a customer or your own colleague. So subject carries the template name for how: whatsapp, with the customer in {{1}} and your note in {{2}}. It is sent straight down the channel - no conversation is opened and no consent is recorded, because your colleague is not a customer and should not appear as one.
send_template needs a synced, approved template
When the template has been synced, saving checks that the variables match its slots. When it has not, the workflow saves and the name is only checked when the step runs, which may be a day later against a real customer. Sync from Meta first.
Versions
POST /v1/workflows/{id}/versionsPublishing a new definition creates a version rather than overwriting. Runs already in flight continue on the version they started with — a customer half way through a three-day sequence does not switch to new logic overnight, which would produce a follow-up that makes no sense given the message before it.
Enable, disable, rename
PATCH /v1/workflows/{id}
{ "enabled": false }Send only the fields you mean to change
This is a real incident, not a hypothetical. A workflow was PATCHed from an API console with every field populated by the tool's placeholder defaults — triggerEventType became the literal string "string" and enabled became false. Events then matched nothing, silently, and the count of matched workflows read zero for a day before anybody worked out why.
Watching a run
Open a run from a workflow's Activity, a customer's automations, or workspace Activity. Owners and staff can choose Stop this run and confirm to end that customer's selected run, including its AI handoff. Other runs continue and future events can start new ones. Its history records who stopped it. This is not a permanent opt-out or a pause you can resume. Messages already sent cannot be recalled, and an action already executing may finish before the stop.
POST /v1/workflows/runs/{runId}/stopGET /v1/workflows/{id}/runs
GET /v1/workflows/runs/{runId}The second returns the run's full history: every step entered, every condition and how it evaluated, every action and what it returned. That history is the answer to “why did my customer get this?”, and it is why refusals are recorded rather than thrown away — a run that was told the window had closed says so, in order, with a timestamp.
Next
Suppression →
Who must never be messaged, and why no caller can route around it.