Discover how to integrate and manage your notification system with our simple yet powerful messaging service.
Message templates in MsgGO allow you to customize the content and format of notifications sent to various delivery targets when an event is received. Using our visual message builder, you can create a single, universal message template that automatically adapts to each delivery channel - whether it's Slack, Email, Discord, SMS, or any other supported platform.
Message templates define how your notifications appear when delivered to destinations like Slack, email, or SMS. With MsgGO's revolutionary unified template system, you can:
Each event definition can have multiple message templates, allowing you to create different message variants for different scenarios or audiences.
Unlike traditional messaging systems that require separate templates for each channel, MsgGO uses a smart, block-based approach:
This means you write your message once, and it works beautifully everywhere!
You can create message templates in two ways:
The message builder uses a block-based system. Each block represents a different type of content. Currently, MsgGO supports the following blocks:
The Text block allows you to add formatted text content to your message.
Features:
Example:
Hello!
{% if data.status == "success" %}
Operation completed successfully!
{% else %}
Operation failed. Please check the logs.
{% endif %}
Event: {{ event.name }}
Time: {{ event.receivedAt }}
Status: {{ data.status }}
The Table block allows you to display data from your events in a structured table format.
Features:
Configuration:
Example configuration:
data.items
When you send an event like this:
{
"event": "order-received",
"items": [
{"name": "Product A", "quantity": 2, "price": "$20"},
{"name": "Product B", "quantity": 1, "price": "$15"}
]
}To add a block to your template:
You can change the order of blocks in your template to control how information is presented:
How to Reorder:
The order of blocks in the builder determines the order they appear in the final message across all delivery channels. Use reordering to:
Tip: The first block in your template appears at the top of all messages, so place your most critical information there.
You can add conditions to blocks to control when they should be displayed. This is done using the if statement in the block configuration.
To add a condition to a block:
data.status, data.type)
equals - exact match
not equals - anything except the value
Example Condition:
Property: data.status
Operator: equals
Value: successif | data.status equals "success"data.status equals "success"
data.items contains "error"
data.count greater than 100
This allows you to create dynamic templates that show different content based on the event data received. Blocks without conditions are always displayed.
The Summary field is a crucial part of your message template. It provides a concise, 160-character summary of your message.
Where Summary is Used:
Important: For channels that only display the summary (like SMS and Push), MsgGO automatically appends a link to the full message at https://usemumu.com/inbox, allowing recipients to view the complete formatted message in their browser.
MsgGO includes an AI-powered feature to automatically generate summaries from your message content:
How to Use Auto-Generate:
What Auto-Generate Does:
Tips for Best Results:
The auto-generated summary serves as an excellent starting point, but you can always customize it to match your exact requirements.
Summary Best Practices:
MsgGO uses Twig as its templating language in Text blocks. Twig is a flexible, secure, and feature-rich template engine that provides powerful features for creating dynamic content.
Variables: Access data with double curly braces:
{{ event.name }}Conditionals: Create different outputs based on conditions:
{% if data.status == 'success' %}
Success!
{% else %}
Failure!
{% endif %}Loops: Iterate through data collections:
{% for item in data.items %}
- {{ item.name }}
{% endfor %}Set: Create new variables or modify existing ones:
{% set greeting = 'Hello' %}
{% set name = data.user.firstname %}
{{ greeting }}, {{ name }}!Filters: Modify variables and expressions:
{{ data.message|upper }}When creating message templates, you can use the following variables to insert dynamic content:
| Variable | Description |
|---|---|
event.name
|
Event name |
event.receivedAt
|
Date of receiving the event (format: YYYY/MM/DD HH:MM:SS) |
data
|
Object containing all data delivered with the event. To see all data in serialized form, use the json_encode filter: `{{ data |
data.keyName
|
Access to a specific key in the data |
To insert these variables into your template, place them between double curly braces as per Twig syntax. For example:
New event received: {{ event.name }}
Time: {{ event.receivedAt }}
Status: {{ data.status }}Filters allow you to modify variables and expressions. They are separated from the variable by a pipe symbol (|). Multiple filters can be chained, with the output of one filter applied to the next.
Basic Filter Syntax:
{{ name|title }}Filters with Arguments:
{{ list|json_encode(', ') }}Important: When filtering complex expressions, use parentheses as the filter operator has the highest precedence:
{{ (1..5)|json_encode }}
{{ ('HELLO' ~ 'WORLD')|lower }}Available Filters
MsgGO provides several useful filters that you can use to format your message content. Here's a complete list with examples:
capitalize
Capitalizes the first letter of each word in a string.
{{ "hello world"|capitalize }}
{# Output: Hello World #}default
Provides a default value if the variable is empty or undefined.
{{ data.author|default('Anonymous') }}
{# If data.author is empty, outputs: Anonymous #}date
Formats dates and timestamps into human-readable formats. This filter is highly flexible and accepts various date input types.
{{ data.created_at|date('dd.MM.yyyy') }}
{# Output example: 15.04.2023 #}
{{ data.timestamp|date('HH:mm:ss', 'Europe/Warsaw') }}
{# Output example: 14:30:45 (in Warsaw timezone) #}Parameters:
Format Options:
The format parameter accepts two types of values:
Example using a preset:
{{ data.timestamp|date('DATETIME_FULL') }}
{# Output: October 14, 1983 at 1:30 PM EDT #}| Standalone token | Format token | Description | Example |
|---|---|---|---|
| S | millisecond, no padding |
54
|
|
| SSS | millisecond, padded to 3 |
054
|
|
| u | fractional seconds, functionally identical to SSS |
054
|
|
| s | second, no padding |
4
|
|
| ss | second, padded to 2 padding |
04
|
|
| m | minute, no padding |
7
|
|
| mm | minute, padded to 2 |
07
|
|
| h | hour in 12-hour time, no padding |
1
|
|
| hh | hour in 12-hour time, padded to 2 |
01
|
|
| H | hour in 24-hour time, no padding |
9
|
|
| HH | hour in 24-hour time, padded to 2 |
13
|
|
| d | day of the month, no padding |
6
|
|
| dd | day of the month, padded to 2 |
06
|
|
| L | M | month as an unpadded number |
8
|
| LL | MM | month as a padded number |
08
|
| LLL | MMM | month as an abbreviated localized string |
Aug
|
| LLLL | MMMM | month as an unabbreviated localized string |
August
|
| y | year, unpadded |
2014
|
|
| yy | two-digit year |
14
|
|
| yyyy | four- to six- digit year, pads to 4 |
2014
|
|
| Z | narrow offset |
+5
|
|
| ZZ | short offset |
+05:00
|
|
| ZZZ | techie offset |
+0500
|
|
| ZZZZ | abbreviated named offset |
EST
|
|
| z | IANA zone |
America/New_York
|
|
| a | meridiem |
AM
|
|
| ccc | EEE | day of the week, as an abbreviate localized string |
Wed
|
| cccc | EEEE | day of the week, as an unabbreviated localized string |
Wednesday
|
And many more tokens for formatting date and time components. Some additional useful tokens:
| Token | Description | Example |
|---|---|---|
| X | unix timestamp w sekundach |
1407287224
|
| x | unix timestamp w milisekundach |
1407287224054
|
| D | zlokalizowana data numeryczna |
9/4/2017
|
| T | zlokalizowany 24-godzinny czas |
13:07
|
| f | krótka zlokalizowana data i godzina |
8/6/2014, 1:07 PM
|
Format Token Examples:
{{ data.timestamp|date('yyyy-MM-dd') }} {# 2023-04-15 #}
{{ data.timestamp|date('HH:mm:ss') }} {# 14:30:45 #}
{{ data.timestamp|date('dd MMM yyyy') }} {# 15 Apr 2023 #}
{{ data.timestamp|date('EEEE, MMMM d, yyyy') }} {# Saturday, April 15, 2023 #}
{{ data.timestamp|date('dd.MM.yyyy HH:mm:ss') }} {# 15.04.2023 14:30:45 #}With Timezone:
{{ data.timestamp|date('HH:mm:ss', 'UTC') }}
{{ data.timestamp|date('yyyy-MM-dd HH:mm:ss', 'America/Los_Angeles') }}lower
Converts a string to lowercase.
{{ "HELLO"|lower }}
{# Output: hello #}merge
Merges arrays or objects.
{% set items = { 'apple': 'fruit', 'orange': 'fruit' } %}
{% set new_items = items|merge({ 'car': 'vehicle' }) %}
{# new_items now contains: { 'apple': 'fruit', 'orange': 'fruit', 'car': 'vehicle' } #}number_format
Formats numbers with grouped thousands and specified decimal points.
{{ 1234.5678|number_format(2, '.', ',') }}
{# Output: 1,234.57 #}replace
Replaces strings within a string.
{{ "Hello World"|replace({'Hello': 'Hi', 'World': 'Everyone'}) }}
{# Output: Hi Everyone #}reverse
Reverses a string or an array.
{{ "Hello"|reverse }}
{# Output: olleH #}
{% set array = [1, 2, 3] %}
{% set reversed = array|reverse %}
{# reversed contains: [3, 2, 1] #round
Rounds a number to a specified precision.
{{ 42.123|round }}
{# Output: 42 #}
{{ 42.123|round(2, 'floor') }}
{# Output: 42.12 #}
{{ 42.123|round(2, 'ceil') }}
{# Output: 42.13 #}slice
Extracts a slice of a sequence or string.
{{ "Hello World"|slice(6, 5) }}
{# Output: World #}
{% set array = [1, 2, 3, 4, 5] %}
{{ array|slice(1, 3)|json_encode }}
{# Output: 2, 3, 4 #}title
Returns a title-cased string (first letter of each word capitalized).
{{ "hello world"|title }}
{# Output: Hello World #}trim
Trims whitespace (or other characters) from the beginning and/or end of a string.
{{ " Hello "|trim }}
{# Output: Hello #}
{{ "!!!Hello!!!"|trim('!') }}
{# Output: Hello #}
{{ " Hello "|trim(null, 'left') }}
{# Output: Hello #}upper
Converts a string to uppercase.
{{ "hello"|upper }}
{# Output: HELLO #}url_encode
URL encodes a string or array according to RFC 3986.
{{ "hello world"|url_encode }}
{# Output: hello%20world #}
{% set params = {'key': 'value', 'foo': 'bar'} %}
{{ params|url_encode }}
{# Output: key=value&foo=bar #}When you create a new message template, MsgGO automatically generates a unique, memorable name for it (like "Salmon jolly koala" or "Azure happy panda"). This makes it easy to identify templates at a glance without having to read their full content.
Why Automatic Naming?
You can:
Best Practices:
MsgGO provides a preview function that lets you see exactly how your message will look in each delivery channel before sending it to recipients.
From Inbox:
Before putting your templates into production, test them: