First steps
Courses
Events and Behaviour Tracking
User Data
- How to Add Anchor Links to an Email
- Building Smart Containers
- How to Create a Synchronized Module
- How to Create a Gmail Promotions Annotation for Emails
- All for adaptivity in email builder
- Editing HTML and CSS
- Adaptive email builder review
- How to Add a Rollover Effect to an Email
- Adding a Video to an Email
- Working with “Images” block
- How to Add Social Media Buttons to an Email
- How to Add a Table to an Email
- How to Add a Background to an Email
- How to Add a Custom Font
- Designing your email
Omnichannel
- Scheduled Mobile Push Message
- How to Create Deep Links and Universal Links
- Setting Up Delivery and Clicks Analytics
- Mobile Push Campaign Report
- Managing mobile SDK access keys
- Creating Mobile Push Messages
- How to Create a Google Project for Mobile Push Notifications
- SDK for Mobile Apps
- Connecting Mobile Apps with Yespo
- Service Worker. Troubleshooting
- How to Send Web Push Notifications from a Website
- How to Create a Web Push Notification
- How to Set Up Web Pushes for Safari
- How to Create a Google Project to Collect Tokens for Web Push Notifications
- Sending user a personalized Push notification depending on his activity on the website
- How to Set Up Subscription Form for Your Website
- Integrating widgets with GA
- How to Set up Informers for Your Site
- Creating Pop-ups via Google Tag Manager or WordPress
- How to Set Modal Window on Your Website
- How to Set Up Floating Box Widget for Your Website
- Creating a Widget Launcher
- How to Set Up Age Gate Widget for Your Website
Automation
- How to Set Up Double Opt-In
- How to Set Up an Automated Birthday Campaign
- Launching a Workflow After a Contact Import
- How to Set Up Notifications for Trigger Control
- How to add scenario to the button
- Workflow Troubleshooting
- How to Automate Customer Reactivation
- How to Launch a Regular Workflow for a Segment
- How to Create a Welcome Email Series
Personalization
Analytics
Multilanguage Campaigns
API
Security and Compliance
Integration
Introduction to Velocity
Apache Velocity is a software product consisting of several Java libraries. The product's main component is the Velocity Engine, a library that allows you to generate dynamic output content (images, links, text) based on message templates.
Velocity conditionals such as if/else, for, and foreach allow you to set flexible conditions for displaying content depending on the JSON object parameters. More about velocity variables’ types and functions to use in Yespo >
Velocity Engine could be used both in bulk campaigns and triggered campaigns.
Dynamic content in messages is used to substitute the personalized data to send to the user — for example, goods on a placed order, the username, or their personal promotional code.
Data for substitution in the message can be transmitted:
- From the user profile in the Yespo system
- From the external data sources
- From the event
No matter where you transfer data from, it enters the Yespo system in the same format: JSON object data with some parameters.
To substitute data from such object to the message, use Velocity variables. Variables are the type of reference that can refer to something defined in the JSON code. The more user data you have, the more dynamic variables you can use.
Referring to JSON object values via variables
JSON (JavaScript Object Notation) is a human-readable text data exchange format based on JavaScript. Easy to read by man and machine.
Formatting of a JSON object is set using curly braces { } containing the data with the key values. The pairs of key values are separated by a colon: {"key" : "value"}. Every pair of values is separated by a comma, so the middle section of the JSON object looks like this:
{
"key" : "value",
"key" : "value",
"key": "value"
}.
As an example, the object which is transmitted in the event by the smartsend API method containing two pairs of key values looks as follows:
{
"discount": "5%",
"link": "https://example.site.com/items_for_sale"
}
To display the transmitted values in a message, you have to use the velocity structure $!data.get('discount') and $!data.get('link') in the message, where:
- $!data.get — command to extract data,
- value in quotes and brackets indicates the field where to extract data from.
After data substitution when sending, the message will look as follows:
The value “5%” substitutes the discount variable, and the value https://site.com/items_for_sale substitutes the link variable as the link for the button.
For more information on how to use velocity variables, see the articles below: