Skip to main content

AI Generation

Describe the form you need in plain language, and SendSeven's AI builder writes a complete, valid builder doc for you: screens, components, field mappings and texts in your language. You can then refine single screens or components with an instruction.

Plan

AI generation needs the Professional plan or higher, and AI features must be turned on for the workspace. On plans with dynamic flows (Scale and higher), the AI may build dynamic flows; on other plans it builds static flows only.

MethodEndpointPurpose
POST/whatsapp-flows/ai/estimateHow many AI credits a generation costs.
POST/whatsapp-flows/ai/generateStart a generation job.
POST/whatsapp-flows/ai/refineStart a job that rewrites one screen or component.
GET/whatsapp-flows/ai/jobs/{job_id}Poll a job.

All four need the scope whatsapp_flows:write.

The AI endpoints do not save anything. They return a builder doc; you save it with the normal create or versions endpoints.

Cost: AI credits​

Beta

WhatsApp Flows is in beta. During the beta, completed flows and AI-builder generations are free. Every flow you send counts as one message from your plan's message pool, like any other WhatsApp message. Additional charges per completed flow will apply once WhatsApp Flows becomes generally available; we will announce them in advance.

Once WhatsApp Flows is generally available, generations will be billed in AI credits from your plan's shared message pool. Check the price before you start:

curl -X POST https://api.sendseven.com/api/v1/whatsapp-flows/ai/estimate \
-H "Authorization: Bearer s7_api_a1b2c3d4e5f6789012345678abcdef00" \
-H "Content-Type: application/json" \
-d '{}'
{
"dynamic_allowed": true,
"credits": 0,
"price_euros": "0.000000",
"billable": false,
"charged_on": "valid_generation",
"refine_credits": 0,
"max_repair_rounds": 3
}
FieldMeaning
creditsAI credits for one successful generation.
refine_creditsAI credits for one successful refinement.
price_eurosThe same amount in euros, when it is not covered by your pool.
billableWhether generations are currently charged at all. false during the beta.
charged_onvalid_generation: you are only charged when the job returns a valid doc. Failed jobs and invalid results are free.
dynamic_allowedWhether the AI may build dynamic flows on your plan.
max_repair_roundsHow often the AI may fix its own validation errors within one job.

The example shows the beta values (free). Always use the estimate.

Generate​

Generations take about one to three minutes, so they run as jobs. Start one:

curl -X POST https://api.sendseven.com/api/v1/whatsapp-flows/ai/generate \
-H "Authorization: Bearer s7_api_a1b2c3d4e5f6789012345678abcdef00" \
-H "Content-Type: application/json" \
-d '{
"description": "Rückrufformular für ein Autohaus: Name, Telefon-Zeitfenster (vormittags/nachmittags/abends), Anliegen (Kauf, Werkstatt, Leasing) und eine Newsletter-Einwilligung.",
"language": "de",
"flow_name": "Rückruf Autohaus",
"request_id": "crm-req-20261003-0042"
}'
FieldNotes
descriptionRequired, 5–4000 characters. What the form should do.
languageBCP-47 code of the texts. Defaults to the workspace language.
flow_nameOptional name, up to 200 characters.
channel_idOptional WhatsApp channel the flow is for.
request_idOptional idempotency key (8–64 characters: letters, digits, _ . : -). A retry with the same key returns the same job, never a second run or charge.

Response 202:

{
"job_id": "job_6f1e…",
"kind": "generate",
"status": "queued",
"stage": null,
"repair_round": 0,
"result": null,
"error": null,
"request_id": "crm-req-20261003-0042",
"created_at": "2026-10-03T09:00:00Z",
"updated_at": "2026-10-03T09:00:00Z"
}

Poll the job​

curl https://api.sendseven.com/api/v1/whatsapp-flows/ai/jobs/job_6f1e… \
-H "Authorization: Bearer s7_api_a1b2c3d4e5f6789012345678abcdef00"

Poll every few seconds. status goes queued → running → succeeded or failed. While running, stage is generating, repairing or validating. Jobs are kept for 24 hours.

{
"job_id": "job_6f1e…",
"kind": "generate",
"status": "succeeded",
"repair_round": 1,
"result": {
"builder_doc": { "schema_version": 1, "meta": { "name": "Rückruf Autohaus", "kind": "static", "language": "de" }, "screens": [ … ] },
"issues": [],
"valid": true,
"compiled_preview": { "version": "7.3", "screens": [ … ] },
"credits_used": 0,
"model_used": "…",
"repair_rounds": 1,
"generation_id": "gen_2b7c…",
"language": "de",
"fallback_used": false
},
"error": null
}
  • valid: false means the doc still has errors (listed in issues). Nothing was charged. Fix it yourself or refine it.
  • error.code on a failed job is one of ai_unavailable, ai_error, invalid_request, interrupted, not_found. Nothing was charged.

Save the result​

Create a flow from the result and pass the generation id, so the version is marked as AI-generated:

curl -X POST https://api.sendseven.com/api/v1/whatsapp-flows \
-H "Authorization: Bearer s7_api_a1b2c3d4e5f6789012345678abcdef00" \
-H "Content-Type: application/json" \
-d '{
"name": "Rückruf Autohaus",
"origin": "ai",
"ai_generation_id": "gen_2b7c…",
"builder_doc": { … }
}'

origin: "ai" requires a builder_doc (422 invalid_origin). From here on, the flow is a normal flow: review it, then publish it.

Refine​

Rewrite one screen, or one component of a screen, while the rest of the doc stays unchanged:

curl -X POST https://api.sendseven.com/api/v1/whatsapp-flows/ai/refine \
-H "Authorization: Bearer s7_api_a1b2c3d4e5f6789012345678abcdef00" \
-H "Content-Type: application/json" \
-d '{
"builder_doc": { … },
"instruction": "Frage zusätzlich nach dem Fahrzeugmodell als Dropdown.",
"target": { "screen_id": "ANLIEGEN" },
"language": "de"
}'
FieldNotes
builder_docThe current doc.
instruction3–2000 characters.
target.screen_idThe screen to rewrite.
target.component_indexOptional (0–200). Rewrites only this component. Omit it to rewrite the whole screen.
language, channel_id, request_idAs for generate.

A target that does not exist is rejected at once with 422. Otherwise the response is a job (202); poll it like a generation.

Errors​

AI errors use the same {code, message} shape as the rest of the WhatsApp Flows API. For older clients, error repeats code:

{ "detail": { "code": "ai_disabled", "error": "ai_disabled", "message": "AI features are turned off for this workspace." } }
StatuscodeCause
403ai_disabledAI features are turned off in the workspace settings.
403feature_disabledThe plan does not include AI features (Professional and higher) or WhatsApp Flows. feature names the missing feature. This error has no error or message key.
422invalid_requestFor example an unknown refine target.
429rate_limit_exceededToo many generate/refine calls; the default limit is 60 per hour per workspace. See Retry-After and retry_after.
502ai_errorThe AI builder could not create a flow. Nothing was charged; try again.
503ai_unavailableThe AI builder is busy. Retry after the Retry-After seconds.
404job_not_foundUnknown job, or a job of another workspace.