JSON Schema Documentation for Programmatic Form Generation?
Hey everyone! 👋
Apologies if this is documented somewhere - I've searched through the docs, GitHub, and previous Discord posts but couldn't find these technical details.
I'm working on automating complex multi-path forms with conditional logic and need to generate Typebot JSON programmatically instead of using the UI. I've got a local LLM/coding agent that I'm training to help build these flows, but I'm missing some key technical documentation.
What I'm looking for:
1. Complete JSON Schema - Is there official documentation on all valid block types, their properties, and required fields? The exported JSONs show the structure but not all possible options.
2. Block Type Reference - Specifically need:
- All available block types and their exact type strings
- Required vs optional properties for each block
- How conditional logic blocks evaluate expressions
- Webhook configuration parameters
3. Edge/Flow Logic - How do edges determine flow between groups? I see itemId references in conditions but unclear on:
- How to properly link conditional branches
- Multiple outgoing edges from single blocks
- Fallback/default path handling
4. Variable Operations - For Set Variable blocks:
- What expressions/functions are available?
- How to reference other variables in calculations?
- Client-side vs server-side execution differences?
5. Version Compatibility - Currently on v2.28.0 self-hosted. Are there version-specific JSON format differences I should account for?
Use Case: Building intake forms with 50+ conditional paths, complex calculations (overage fees, package recommendations), and webhook integrations. UI is great but need to generate variations programmatically.
Has anyone documented the complete JSON structure or built tools for programmatic typebot generation? Even unofficial docs or reverse-engineered schemas would be super helpful.
Sorry if I missed obvious documentation - searched for "JSON schema", "programmatic", "block types" etc. but mostly found UI tutorials.
Thanks! 🚀
7 Replies
Update - made some progress through trial and error:
What I've confirmed:
- Exports CAN be re-imported successfully (my test export works fine)
- The minified, single-line format without wrapper is correct
- My workspace export structure: starts directly with
{"version":"6","id":...
no wrapper needed
What I'm trying to build:
A programmatic JSON generator that creates forms with:
- Complex conditional logic (if accounts >= 6, force Professional package)
- Set Variable blocks with calculations (overage fees at $40/account over 3)
- Condition blocks with multiple branches
- Dynamic text showing calculated values
Specific questions:
1. For Set Variable blocks with calculations, what's the exact syntax? My attempts with expressionToEvaluate
aren't working
2. How do Condition blocks evaluate complex expressions like {{var_account_count}} >= 4 && {{var_account_count}} <= 5
?
3. What makes an edge "outgoing" from a block vs from an item within that block?
I can build simple forms in the UI and export them fine, but generating the JSON programmatically for complex logic is where I'm stuck.
Anyone have examples of working Set Variable or Condition blocks they could share? Particularly interested in how the expression evaluation works.
The use case is generating variations of intake forms with different business logic without manually clicking through the UI each time.It's not very well documented so you'll have to dig it a bit
Q1: sdocs.typebot.io/get-started/introduction
Q2: https://github.com/baptisteArno/typebot.io/blob/a65bc020f13fceb2ade373dfaca6d40d53d02993/packages/conditions/src/schemas.ts
Q3: Block have an optional
outgoingEdgeId
prop and Items also have that propThanks @Baptiste! Quick follow-up on the comparison operators:
In the schemas.ts file, I see the comparisonOperators are string literals like "Equal to", "Greater than", etc.
For my use case with account-based package forcing, would this be the correct structure?
Also, for Set Variable blocks doing calculations, is expressionToEvaluate the right property and does it need "isCode": true?
That looks fine to me!
Exactly!
you need
isCode
set to true
if your expression is code
Non code example:
Code example:
Title: Set Variable JavaScript expressions failing - Unexpected token '.'
Hi Baptiste or anyone in the know,
I'm getting SyntaxError: Unexpected token '.' errors when trying to use JavaScript expressions in Set Variable blocks (v2.28.0).
My Set Variable block has:
- isExecutedOnClient: true
- isCode: true
But simple expressions like:
{{client_name}}.split(' ')[0]
Are throwing errors. Also having issues with ternary operators:
{{account_count}} >= 9 ? 'Premium' : {{account_count}} >= 6 ? 'Professional' : 'Essential'
What JavaScript syntax is actually supported in Set Variable blocks? Can we:
1. Call methods on variables (.split(), .slice())?
2. Use ternary operators?
3. Do string comparisons (=== 'Premium')?
4. Access array indices ([0])?
I have a complex form with package calculations that depends on these expressions working. Any guidance on what's supported vs what isn't would be incredibly helpful.
I'm documenting all the Typebot schema patterns I discover to create a community resource, so understanding these limitations may be really valuable to share with others.
Thanks!
I advise you to build the bots on Typebot directly and export the JSON to see the resulting schema. Here is your example on the editor:
https://app.typebot.io/typebots/cmejooxzq0001l404k5gfaa7w/edit
Editor
Create and publish conversational forms that collect 4 times more answers and feel native to your product
Thank you, I will do that and handle it all myself moving forward.