Letter Template System - User Guide
Overview
The Letter Template System allows you to create customizable letter templates with dynamic content that can be populated via API calls. Templates support logos, multiple text blocks with formatting options, QR codes, and dynamic variables that are replaced at generation time.
Key Features
Visual Editor: Split-screen interface with live preview
Dynamic Variables: Insert placeholders that are filled via API
Logo Support: Upload and embed logos directly in templates
Text Formatting: Control size, alignment, and weight for each text block
QR Code Integration: Generate or embed QR codes in letters
API Integration: Generate personalized letters via simple API calls
Creating a Template
1. Template Metadata
Template Name: A descriptive name for your template (e.g., "Payment Reminder Letter")
Template ID: Auto-generated slug based on the name, used for API references (e.g., "payment_reminder_letter")
2. Logo Section
Upload: Click "Add new or select from Logo Library" to upload a PNG or JPEG logo
Show/Hide: Toggle visibility with the checkbox
Note: Logos are embedded directly in the template and stored as base64 data
3. Text Blocks
Templates include three text blocks:
Headline Block (Text Block 1)
Single-line text input
Typically used for letter titles or main headings
Formatting options: Size (Small/Medium/Large/X-Large), Alignment (Left/Center/Right), Bold
Body Block (Text Block 2)
Multi-line textarea
Main content area of the letter
Supports line breaks and paragraph formatting
Formatting options: Size, Alignment, Bold
Footer Block (Text Block 3)
Multi-line textarea
Closing remarks, signatures, or legal disclaimers
Formatting options: Size, Alignment, Bold
4. QR Code Section
Two Modes:
Generate Now Mode:
Provide a static URL
QR code is generated immediately and embedded in the template
Choose size: Small (0.75"), Medium (1"), Large (1.5")
Variable Mode:
QR code URL provided via API call
Use
{{qrcode}}variable in the URL fieldQR code generated at order creation time
Using Variables
Variables allow you to insert dynamic content that's populated when generating letters via API.
Variable Syntax
Variables use double curly braces: {{variable_name}}
Example:
Dear {{first_name}} {{last_name}},
Your payment of ${{amount}} is due on {{due_date}}.
Available Variable Helpers
Quick-insert buttons are available for common variables:
{{first_name}}- Recipient's first name{{last_name}}- Recipient's last name{{company}}- Company name{{address}}- Street address{{city}}- City{{state}}- State/Province{{zip}}- Postal code{{venue}}- Custom venue/location
Custom Variables
Click "Custom..." to add your own variables:
{{account_number}}{{due_date}}{{amount_due}}{{tracking_id}}Any custom field name you need
Important: Variables are case-sensitive and should contain only letters, numbers, and underscores.
Saving Templates
Save
Saves the current template
Overwrites existing template data
Returns to template list after saving
Save as New
Creates a copy of the current template
Useful for creating variations
Auto-appends " (Copy)" to the name
Delete
Permanently removes the template
Requires confirmation
Cannot be undone
Using the API
Getting Your API Command
Open a saved template in edit mode
Click "Copy API Example" in the toolbar
A curl command will be copied to your clipboard
API Command Structure
curl -v https://www.mailform.io/app/api/v1/orders \
-F template=YOUR_TEMPLATE_GUID \
-F 'customer_reference=ORDER_REF_001' \
-F 'service=USPS_FIRST_CLASS' \
-F 'to.name=Recipient Name' \
-F 'to.organization=Recipient Company' \
-F 'to.address1=123 Main Street' \
-F 'to.address2=Suite 100' \
-F 'to.city=Boston' \
-F 'to.state=MA' \
-F 'to.postcode=02101' \
-F 'to.country=US' \
-F 'from.name=Your Name' \
-F 'from.organization=Your Company' \
-F 'from.address1=456 Oak Avenue' \
-F 'from.address2=Floor 2' \
-F 'from.city=Cambridge' \
-F 'from.state=MA' \
-F 'from.postcode=02139' \
-F 'from.country=US' \
-H "Authorization: Bearer YOUR_BEARER_TOKEN" \
--form-string "variables={\"first_name\":\"John\"}"
Required Parameters
template: Your template GUID (automatically filled from template)
customer_reference: Your order reference number
service: Mailing service (e.g., USPS_FIRST_CLASS)
to.*: Recipient address fields
from.*: Return address fields
Authorization: Your API bearer token
variables: JSON object with variable values
Variables Parameter
Pass all your template variables as a JSON object:
--form-string "variables={
\"first_name\":\"John\",
\"last_name\":\"Doe\",
\"account_number\":\"12345\",
\"amount_due\":\"$125.00\",
\"due_date\":\"January 31, 2024\"
}"
Best Practices
Template Design
Keep it Simple: Use clear, concise language
Test Variables: Always test with sample data before production use
Consistent Formatting: Use consistent font sizes and alignment
Logo Size: Keep logos under 200x100px for best results
QR Codes: Test QR codes with different sizes to ensure scannability
Variable Naming
Descriptive Names: Use clear variable names (e.g.,
{{payment_amount}}not{{amt}})Consistent Case: Stick to lowercase with underscores
Document Variables: Keep a list of all variables used in each template
Content Guidelines
Trim Whitespace: The system automatically trims leading/trailing spaces
Line Breaks: Use natural line breaks in multi-line blocks
Special Characters: Avoid special characters in variable names
Length Limits: Template names max 128 characters, descriptions max 256 characters
Troubleshooting
Template Not Saving
Check that Template Name and ID are filled
Ensure you're logged in
Verify you have permission to create templates
Variables Not Rendering
Confirm variable syntax:
{{variable_name}}Check spelling matches exactly between template and API call
Ensure variables are passed in the correct JSON format
Logo Not Displaying
Verify logo is PNG or JPEG format
Check file size (recommended under 500KB)
Ensure "Show logo" checkbox is enabled
QR Code Issues
Now Mode: Verify URL is valid and accessible
Variable Mode: Ensure
{{qrcode}}variable is passed in API callTest QR code size for scannability (Medium or Large recommended)
API Response
Successful orders return:
{
"status": "success",
"order_id": "ord_xxx",
"tracking_id": "trk_xxx"
}
Support
For additional help:
Check template preview before saving
Use "Copy API Example" for correct API format
Contact support with template GUID for troubleshooting
