Query parameters
-
The desired format for the generated flow
Values are
xstate
orfragments
. Default value isxstate
. -
Whether to produce an incremental flow (excluding the existing flow) or a full flow
Values are
full
orincremental
. Default value isincremental
.
Body
-
The text description of the flow we should generate
-
The broader context that should be used to interpret
text
.For example, if a user writes:
After users log in, bring them to the home page
and then continues:
Then, if it's their first visit, show them a popup
Providing
After users log in...
as context when passingThen, ...
as the text will result in the correct interpretation of the source state for showing the popup.The context will not contribute to any new transitions. It will only be used to properly interpret
text
.
POST
/flows
curl \
-X POST https://api.flow.simplystated.dev/flows \
-H "x-api-key: $API_KEY" \
-H "Content-Type: application/json" \
-d '{"text":"Open the search autocomplete when the user hovers or focuses in the search box","context":"After users log in, bring them to the home page\n","existingFlow":{"format":"xstate","flow":{"description":"string","on":{"click":[{"cond":"Is valid","target":"Submit","actions":["Show notification"]}]},"after":[{"delay":500,"target":"Timed out","actions":["Show timeout notification"]}],"always":[{"description":"string","cond":"isValid","target":"idle","actions":["sendTelemetry"]}],"entryActions":["sendTelemetry"],"exitActions":["sendTelemetry"],"invoke":[{"src":"saveUser","onDone":[{"description":"string","cond":"isValid","target":"idle","actions":["sendTelemetry"]}],"onError":[{"description":"string","cond":"isValid","target":"idle","actions":["sendTelemetry"]}]}],"states":{}}}}'
Request example
{
"text": "Open the search autocomplete when the user hovers or focuses in the search box",
"context": "After users log in, bring them to the home page\n",
"existingFlow": {
"format": "xstate",
"flow": {
"description": "string",
"on": {
"click": [
{
"cond": "Is valid",
"target": "Submit",
"actions": [
"Show notification"
]
}
]
},
"after": [
{
"delay": 500,
"target": "Timed out",
"actions": [
"Show timeout notification"
]
}
],
"always": [
{
"description": "string",
"cond": "isValid",
"target": "idle",
"actions": [
"sendTelemetry"
]
}
],
"entryActions": [
"sendTelemetry"
],
"exitActions": [
"sendTelemetry"
],
"invoke": [
{
"src": "saveUser",
"onDone": [
{
"description": "string",
"cond": "isValid",
"target": "idle",
"actions": [
"sendTelemetry"
]
}
],
"onError": [
{
"description": "string",
"cond": "isValid",
"target": "idle",
"actions": [
"sendTelemetry"
]
}
]
}
],
"states": {}
}
}
}
Request examples
{
"text": "Open the search autocomplete when the user hovers or focuses in the search box",
"context": "After users log in, bring them to the home page\n",
"existingFlow": {
"format": "xstate",
"flow": {
"description": "string",
"on": {
"click": [
{
"cond": "Is valid",
"target": "Submit",
"actions": [
"Show notification"
]
}
]
},
"after": [
{
"delay": 500,
"target": "Timed out",
"actions": [
"Show timeout notification"
]
}
],
"always": [
{
"description": "string",
"cond": "isValid",
"target": "idle",
"actions": [
"sendTelemetry"
]
}
],
"entryActions": [
"sendTelemetry"
],
"exitActions": [
"sendTelemetry"
],
"invoke": [
{
"src": "saveUser",
"onDone": [
{
"description": "string",
"cond": "isValid",
"target": "idle",
"actions": [
"sendTelemetry"
]
}
],
"onError": [
{
"description": "string",
"cond": "isValid",
"target": "idle",
"actions": [
"sendTelemetry"
]
}
]
}
],
"states": {
"Additional properties:": {
"description": "string",
"on": {
"click": [
{
"cond": "Is valid",
"target": "Submit",
"actions": [
"Show notification"
]
}
]
},
"after": [
{
"delay": 500,
"target": "Timed out",
"actions": [
"Show timeout notification"
]
}
],
"always": [
{
"description": "string",
"cond": "isValid",
"target": "idle",
"actions": [
"sendTelemetry"
]
}
],
"entryActions": [
"sendTelemetry"
],
"exitActions": [
"sendTelemetry"
],
"invoke": [
{
"src": "saveUser",
"onDone": [
{
"description": "string",
"cond": "isValid",
"target": "idle",
"actions": [
"sendTelemetry"
]
}
],
"onError": [
{
"description": "string",
"cond": "isValid",
"target": "idle",
"actions": [
"sendTelemetry"
]
}
]
}
]
}
}
}
}
}
Response examples (200)
{
"id": "string",
"result": {
"format": "xstate",
"flow": {
"description": "string",
"on": {
"click": [
{
"cond": "Is valid",
"target": "Submit",
"actions": [
"Show notification"
]
}
]
},
"after": [
{
"delay": 500,
"target": "Timed out",
"actions": [
"Show timeout notification"
]
}
],
"always": [
{
"description": "string",
"cond": "isValid",
"target": "idle",
"actions": [
"sendTelemetry"
]
}
],
"entryActions": [
"sendTelemetry"
],
"exitActions": [
"sendTelemetry"
],
"invoke": [
{
"src": "saveUser",
"onDone": [
{
"description": "string",
"cond": "isValid",
"target": "idle",
"actions": [
"sendTelemetry"
]
}
],
"onError": [
{
"description": "string",
"cond": "isValid",
"target": "idle",
"actions": [
"sendTelemetry"
]
}
]
}
],
"states": {}
}
}
}
Response examples (200)
{
"id": "string",
"result": {
"format": "xstate",
"flow": {
"description": "string",
"on": {
"click": [
{
"cond": "Is valid",
"target": "Submit",
"actions": [
"Show notification"
]
}
]
},
"after": [
{
"delay": 500,
"target": "Timed out",
"actions": [
"Show timeout notification"
]
}
],
"always": [
{
"description": "string",
"cond": "isValid",
"target": "idle",
"actions": [
"sendTelemetry"
]
}
],
"entryActions": [
"sendTelemetry"
],
"exitActions": [
"sendTelemetry"
],
"invoke": [
{
"src": "saveUser",
"onDone": [
{
"description": "string",
"cond": "isValid",
"target": "idle",
"actions": [
"sendTelemetry"
]
}
],
"onError": [
{
"description": "string",
"cond": "isValid",
"target": "idle",
"actions": [
"sendTelemetry"
]
}
]
}
],
"states": {
"Additional properties:": {
"description": "string",
"on": {
"click": [
{
"cond": "Is valid",
"target": "Submit",
"actions": [
"Show notification"
]
}
]
},
"after": [
{
"delay": 500,
"target": "Timed out",
"actions": [
"Show timeout notification"
]
}
],
"always": [
{
"description": "string",
"cond": "isValid",
"target": "idle",
"actions": [
"sendTelemetry"
]
}
],
"entryActions": [
"sendTelemetry"
],
"exitActions": [
"sendTelemetry"
],
"invoke": [
{
"src": "saveUser",
"onDone": [
{
"description": "string",
"cond": "isValid",
"target": "idle",
"actions": [
"sendTelemetry"
]
}
],
"onError": [
{
"description": "string",
"cond": "isValid",
"target": "idle",
"actions": [
"sendTelemetry"
]
}
]
}
]
}
}
}
}
}