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.
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.
| Method | Endpoint | Purpose |
|---|---|---|
POST | /whatsapp-flows/ai/estimate | How many AI credits a generation costs. |
POST | /whatsapp-flows/ai/generate | Start a generation job. |
POST | /whatsapp-flows/ai/refine | Start 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
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
}
| Field | Meaning |
|---|---|
credits | AI credits for one successful generation. |
refine_credits | AI credits for one successful refinement. |
price_euros | The same amount in euros, when it is not covered by your pool. |
billable | Whether generations are currently charged at all. false during the beta. |
charged_on | valid_generation: you are only charged when the job returns a valid doc. Failed jobs and invalid results are free. |
dynamic_allowed | Whether the AI may build dynamic flows on your plan. |
max_repair_rounds | How 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"
}'
| Field | Notes |
|---|---|
description | Required, 5–4000 characters. What the form should do. |
language | BCP-47 code of the texts. Defaults to the workspace language. |
flow_name | Optional name, up to 200 characters. |
channel_id | Optional WhatsApp channel the flow is for. |
request_id | Optional 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: falsemeans the doc still has errors (listed inissues). Nothing was charged. Fix it yourself or refine it.error.codeon a failed job is one ofai_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"
}'
| Field | Notes |
|---|---|
builder_doc | The current doc. |
instruction | 3–2000 characters. |
target.screen_id | The screen to rewrite. |
target.component_index | Optional (0–200). Rewrites only this component. Omit it to rewrite the whole screen. |
language, channel_id, request_id | As 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." } }
| Status | code | Cause |
|---|---|---|
403 | ai_disabled | AI features are turned off in the workspace settings. |
403 | feature_disabled | The 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. |
422 | invalid_request | For example an unknown refine target. |
429 | rate_limit_exceeded | Too many generate/refine calls; the default limit is 60 per hour per workspace. See Retry-After and retry_after. |
502 | ai_error | The AI builder could not create a flow. Nothing was charged; try again. |
503 | ai_unavailable | The AI builder is busy. Retry after the Retry-After seconds. |
404 | job_not_found | Unknown job, or a job of another workspace. |