Template Variables - merchi Scripting Language (MSL)
Template Variables allow you to dynamically insert product data and asset references into your Schema Builder rules. This powerful feature - which we call MSL (merchi Scripting Language) - uses a simple {{variable}} syntax to make your writing instructions more intelligent and context-aware.
Where to Use MSL
You can use MSL template variables in the Rules field of any Schema block. These rules tell the AI how to generate content for that specific field.
Example: In a Title block’s rules, you might write:
Create a title for this {{inputData.csv.brand}} product.
Include the product name: {{inputData.csv.productName}}
When processing a product, merchi.ai replaces these variables with actual values from your data:
Create a title for this Nike product.
Include the product name: Air Max 90
Available Variables
{{inputData.csv.<column>}}
What it does: Inserts a specific column value from your uploaded CSV.
This is the most useful variable for customizing your writing rules. The column names come directly from your CSV headers.
Example: If your CSV has columns productId, brand, category, level1, level2:
| Variable | What it inserts |
|---|---|
{{inputData.csv.productId}} | The product’s SKU/ID |
{{inputData.csv.brand}} | The brand name |
{{inputData.csv.category}} | The product category |
{{inputData.csv.level1}} | First level of category hierarchy |
{{inputData.csv.level2}} | Second level of category hierarchy |
Using in Schema Rules:
Write a description for this {{inputData.csv.category}} product.
The brand is {{inputData.csv.brand}}, so ensure the tone matches their brand guidelines.
This product sits in the {{inputData.csv.level1}} > {{inputData.csv.level2}} category.
{{inputData.csv.rest}}
What it does: Inserts all CSV columns that haven’t been explicitly used elsewhere in your rules.
This is a “catch-all” variable. If you’ve already used {{inputData.csv.brand}} and {{inputData.csv.category}} in your rules, {{inputData.csv.rest}} outputs all the OTHER columns as JSON.
Example usage:
Key product details:
- Brand: {{inputData.csv.brand}}
- Category: {{inputData.csv.category}}
Additional data to consider:
{{inputData.csv.rest}}
This is useful when your CSV contains many columns and you want to ensure the AI considers all available data without listing each column individually.
{{inputData.scrape.<field>}}
What it does: Inserts data from web scraping (when using URL-based imports).
When you import products via URL scraping, the scraped data becomes available:
| Variable | What it inserts |
|---|---|
{{inputData.scrape.title}} | The scraped product title |
{{inputData.scrape.description}} | The scraped description |
{{inputData.scrape.id}} | The scraped product ID |
{{inputData.scrape.attributes}} | The scraped attributes |
Using in Schema Rules:
The existing product title is: {{inputData.scrape.title}}
The existing description is: {{inputData.scrape.description}}
Improve upon this content while maintaining accuracy.
{{imageNames.N}} and {{imageFileNames.N}}
What it does: Inserts the file name of a specific uploaded image, derived automatically from your uploaded files.
{{imageNames.N}}— file name without extension (e.g.IMG_1234){{imageFileNames.N}}— file name with extension (e.g.IMG_1234.jpg)
Replace N with the position of the image (starting at 0 for the first image).
You can also use {{imageNames}} or {{imageFileNames}} without an index to insert all image names as a JSON array.
| Variable | What it inserts |
|---|---|
{{imageNames.0}} | First image file name, no extension |
{{imageNames.1}} | Second image file name, no extension |
{{imageFileNames.0}} | First image file name, with extension |
{{imageFileNames}} | All image file names as a JSON array |
Using in Schema Rules:
This is particularly useful for the Image Metadata block, where you want the AI to generate SEO-friendly names that reference or improve upon the original file name:
The original file name for this image is: {{imageNames.0}}
Generate an SEO-friendly image name in dash-case based on the product visible in the image.
The output imageName should be descriptive and relevant, not just a copy of the original.
Or to enforce that the original name is used and only improved:
Provide SEO-friendly image names and alt text for each image.
The original file names are: {{imageNames}}
Use these as a reference. Your imageName output should be a descriptive, dash-case SEO version.
{{assets.<name>}}
What it does: Inserts a specific Writing Asset by its name.
While assets are typically attached to blocks via the UI, you can also reference them directly in your rules for more specific guidance.
Example usage:
Use the following attributes list when selecting product attributes:
{{assets.attributes}}
Ensure the tone matches:
{{assets.brand_tone_of_voice}}
Tip: For most use cases, simply attaching assets to blocks via the Schema Builder UI is sufficient. Use
{{assets.<name>}}when you need to reference an asset in a specific context within your rules.
Practical Examples
Category-Aware Title Generation
Create a title for this {{inputData.csv.category}} product from {{inputData.csv.brand}}.
Guidelines:
- 5-10 words maximum
- Include the brand name naturally
- Make it search-friendly for the {{inputData.csv.level1}} category
Brand-Specific Descriptions
Write a product description for {{inputData.csv.brand}}.
This product is categorized as: {{inputData.csv.level1}} > {{inputData.csv.level2}} > {{inputData.csv.level3}}
Adjust the tone and vocabulary to match this brand's positioning.
Maximum 150 words in 2 paragraphs.
Passthrough with Dynamic Fallback
Use the value from {{inputData.csv.title}} if provided.
If empty, generate a title based on:
- Brand: {{inputData.csv.brand}}
- Category: {{inputData.csv.category}}
- Key features visible in the images
Multi-Brand Stores
If you process products from multiple brands, you can use MSL to make your rules brand-aware:
This is a {{inputData.csv.brand}} product.
For premium brands, use elevated vocabulary.
For everyday brands, use accessible, friendly language.
Adjust your writing style based on the brand positioning.
Scrape Enhancement
When improving scraped content:
Original product data:
- Title: {{inputData.scrape.title}}
- Description: {{inputData.scrape.description}}
Rewrite this content to:
- Match our brand tone of voice
- Improve SEO friendliness
- Maintain factual accuracy from the original
SEO Image Naming with Original File Reference
Use the original image file name as context when generating SEO-friendly names:
Provide SEO-friendly image metadata for each image in the order provided.
The original file names are: {{imageNames}}
For each image:
- imageName: a descriptive, dash-case SEO name based on what is visible in the image
- imageAltTag: a sentence-case description for accessibility
Do not just copy the original file name. Use it as a reference only.
Variable Behavior
Dot Notation
Use dots to access nested data:
{{inputData.csv.level1}} → "Clothing"
{{inputData.csv.brand}} → "Nike"
Missing Variables
If a variable path doesn’t exist in your data, the placeholder remains unchanged. This helps you identify when column names don’t match.
Arrays and Objects
When a variable contains an array or object, it’s automatically converted to a JSON string.
Tips for Using MSL Effectively
1. Match Column Names Exactly
Variable names are case-sensitive and must match your CSV headers exactly:
- ✅
{{inputData.csv.productId}}(if your CSV header is “productId”) - ❌
{{inputData.csv.ProductID}}(wrong case) - ❌
{{inputData.csv.product_id}}(different format)
2. Test with Sample Data
After adding MSL variables to your rules:
- Process a test product
- Review the output to verify variables were replaced
- Check for any unreplaced
{{placeholders}}which indicate mismatched names
3. Use for Context, Not Just Values
MSL is most powerful when it helps the AI understand context:
# Good - provides context
This is a {{inputData.csv.category}} product from {{inputData.csv.brand}}.
Adjust the tone and detail level accordingly.
# Less effective - just inserting values
Brand: {{inputData.csv.brand}}
Category: {{inputData.csv.category}}
4. Combine with Static Rules
Mix MSL variables with your standard writing instructions:
Write a description in maximum 150 words.
The product is from {{inputData.csv.brand}} in the {{inputData.csv.category}} category.
Use an engaging tone that matches the Brand Tone of Voice asset.
Do not use banned phrases from the Stop Words list.
Quick Reference
| Variable | Description | Example Output |
|---|---|---|
{{inputData.csv.<column>}} | Specific CSV column value | "Nike" |
{{inputData.csv.rest}} | All unused CSV columns | {"color":"Black","size":"M"} |
{{inputData.scrape.title}} | Scraped product title | "Air Max 90 Sneakers" |
{{inputData.scrape.description}} | Scraped description | "Classic sneaker..." |
{{assets.<name>}} | Specific Writing Asset | Asset content |
{{imageNames.0}} | First image file name, no extension | "IMG_1234" |
{{imageNames.N}} | Nth image file name, no extension | "IMG_1235" |
{{imageNames}} | All image file names, no extension | ["IMG_1234","IMG_1235"] |
{{imageFileNames.0}} | First image file name, with extension | "IMG_1234.jpg" |
{{imageFileNames}} | All image file names, with extension | ["IMG_1234.jpg","IMG_1235.jpg"] |
Related Topics
- Schema Configuration - Learn how to create and configure schema blocks
- Writing Knowledge - Create assets that can be referenced with
{{assets.<name>}} - Advanced Writing Assets - Build sophisticated JSON assets for category-specific tone control
