SPINTAX Syntax: Variations and Nested Functions
🎯 Document Purpose
This document describes all supported syntax constructions for creating variable text in messages. Using these constructions, you can create diverse unique messages from a single template.
📋 Basic Constructions
1. Pick one variant: {option1|option2|…}
Syntax: {option1|option2|option3}
What it does: Randomly selects ONE option from the list
Examples:
{Hi|Hello|Hey}→ “Hi” OR “Hello” OR “Hey”{Good morning|Good afternoon|Good evening}→ picks one of three options{how are you|how's it going|what's up}→ one question variant
Why use it: Creates natural variation in greetings, questions, closings
2. Shuffle all variants: [+X+A|B|C|D|…]
Syntax: [+X+A|B|C|D|...]
What it does: Shuffles all variants and joins them with separator X. X can be any character or text between plus signs.
Examples:
[+, +apple|pear|banana]→ “apple, pear, banana” (X = “, “)[+ +first|second|third]→ “first second third” (X = ” “)[+ and +first|second]→ “first and second” (X = ” and “)[+ / +one|two|three]→ “one / two / three” (X = ” / “)[+-+date1|date2|date3]→ “date1-date2-date3” (X = “-“)
Why use it: When you need to list multiple items in one message
🔄 Nested Constructions
Nested selection {option1|option2{suboption1|suboption2}}
Syntax: Curly braces inside curly braces
Examples:
{Good {morning|afternoon|evening}|Hello}
→ “Good morning” OR “Good afternoon” OR “Good evening” OR “Hello”{Hi {world|universe}|Hello, friends}
→ “Hi world” OR “Hi universe” OR “Hello, friends”
Why use it: Creating more complex and natural combinations
Nested joining [+separator+option1|{suboption1|suboption2}]
Syntax: Curly braces inside square brackets
Examples:
[+ +I|you|he]→ “I you he”[+, +{Hi|Hello}|Good day]
→ “Hi, Good day” OR “Hello, Good day”
Why use it: Combining elements where some have variants
🎨 Combined Examples
Example 1: Personal message
{Hi|Hello}, {{Name}}! {How are you|What's new}? I'd like to offer you [+, +great deal|interesting service|excellent solution].
Result (one variant):
Hello, John! What's new? I'd like to offer you interesting service, excellent solution.
Example 2: Event invitation
{Good morning|Good afternoon}, {{Name}}! We invite you to [+, +conference|exhibition|seminar]. Dates: [+-+03/17|03/18|03/19].
Result (one variant):
Good afternoon, Sarah! We invite you to exhibition, seminar. Dates: 03/17-03/18-03/19.
Example 3: Marketing offer
{{Name}}, we have a {new promotion|special offer}! {20|30|50}% discount on [+, +men's clothing|women's clothing|kids' clothing].
Result (one variant):
John, we have a special offer! 30% discount on men's clothing, kids' clothing.
📊 Construction Comparison
| Construction | Result | When to use |
|---|---|---|
{A|B|C} | ONE random variant | Greeting, question, closing |
[+, +A|B|C] | ALL variants with commas | Enumeration, list |
{A{B|C}|D} | ONE of: “AB”, “AC” or “D” | Complex variants |
[+, +{A|B}|{C|D}] | Join random variants | Flexible enumeration |
⚙️ Technical Details
Processing in Code
Processing order:
- First, placeholders
{{KEY}}are substituted from Excel table - Then
{option1|option2}constructions are processed – random choice (ONE selected) - Then
[+X+Y]constructions are processed – permutations (all variants via separator X) - Process repeats up to 50 times for nested constructions
How [+X+Y] works:
X– separator (can be any character or text: comma, space, word, etc.)Y– variants separated by|- All variants from
Yare shuffled and joined with separatorX - Example:
[+, +A|B|C]→ separator,, result: “A, B, C” (or other shuffle after mixing)
Limitations
⚠️ Important:
- Maximum 50 iterations for nested constructions
- Recommended no more than 3 nesting levels
- Empty variants are automatically removed
- Unclosed brackets may lead to unexpected results
💡 Practical Tips
Tip 1: Use the right construction
❌ Wrong: {Hi, apple, pear, banana} – this is not enumeration, it’s selection
✅ Right: {Hi|Hello}, [+, +apple|pear|banana]
Tip 2: Avoid excessive nesting
❌ Too complex: {A{B{C{D|E}|F}|G}|H}
✅ Simpler: {A|B|C|D} or split into multiple blocks
Tip 3: Choose the right separator
Separator can be any character or text between plus signs:
[+, +]– comma and space (“, “)[+ +]– space (” “)[+ and +]– ” and “[+-+]– hyphen (“-“)[+ / +]– ” / “[+ any word +]– your custom word
Tip 4: Combine with placeholders
{Hi|Hello}, {{Name}}! {How are you|What's new}?
Your {number|phone}: {{Phone}}.
Tip 5: Variations in Excel
You can specify variations {A|B|C} directly in Excel columns – this increases message uniqueness
🔍 Examples with Explanations
Example A: List of items
Template: We have [+, +apples|pears|bananas]
Result: We have apples, pears, bananas
Why: [+, +] joins ALL variants with comma and space
Example B: One option from list
Template: Best choice - {apples|pears|bananas}
Result: Best choice - apples (random)
Why: {...} picks ONE variant randomly
Example C: Combination of selection and permutations
“`
Template: You have [+, +{desk|writing desk}|{chair|armchair}|{lamp|light}]
Result: You have writing desk, chair, lamp (from each {} ONE variant is picked, then all joined with comma)
Why: Inside [+, +] you can use {...} to pick random variant in each position
🎯 Common Mistakes
Mistake 1: Confusion between {|} and [+ +]
❌ {apple, pear, banana} → will pick ONE whole thing ✅ [+, +apple|pear|banana] → will list ALL
Mistake 2: Unclosed brackets
❌ {Hi|Hello ✅ {Hi|Hello}
Mistake 3: Wrong joining syntax
❌ [+A|B|C] – missing second + ✅ [+, +A|B|C] – correct format
💡 Maximum Uniqueness with Excel
Combining selection {A|B|C} and permutations [+X+A|B|C] in Excel:
- You can specify variations directly in Excel columns:
{Hi|Hello},{20%|30%|50%} - Each column can contain unique variations for selection and permutations
- Combination of all variations creates incredibly high variability – up to complete uniqueness of each message