Scripting
Features like automations and snippets often need to generate dynamic text.
For instance:
- Setting record fields
- Sending email messages
- Responding to chat messages
- Sending text messages
- Executing HTTP requests
- Generating notifications
- …and so on
The content of this text may need to vary depending on any number of factors – the current worker, record, automation inputs, day of week, etc.
In a traditional programming language, you typically generate text output like:
print("Hello, " + firstName + "!");
This is cumbersome when you’re dealing with a lot of text.
Instead, Cerb scripting is a full-featured templating language based on Twig1. A templating language makes the simple assumption that everything you type is text output until it encounters a special command.
The example code above would instead be written as:
Hello, {{first_name}}!
Topics
- Variables
- Strings
- Arrays and Objects
- Dates
- Conditional Logic
- Operators
- Loops
- Regular Expressions
- JSON
- XML
- Commands
- Functions
- Filters
- Tests
References
-
Twig: The flexible, fast, and secure template engine for PHP - https://twig.symfony.com ↩