Logo

Docs / MsgGO

Discover how to integrate and manage your notification system with our simple yet powerful messaging service.

Docs

Message Templates

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.

Understanding Message Templates

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:

  • Create one universal template that works across all delivery channels
  • Build messages using intuitive visual blocks
  • Let MsgGO automatically format your message for each delivery target
  • Include dynamic content using event data variables
  • Create conditional content using Twig templating language

Each event definition can have multiple message templates, allowing you to create different message variants for different scenarios or audiences.

How the Unified Template System Works

Unlike traditional messaging systems that require separate templates for each channel, MsgGO uses a smart, block-based approach:

  1. You create one template using our visual builder
  2. Add content blocks (text, tables, etc.) to structure your message
  3. MsgGO automatically translates your template to the appropriate format for each delivery target:
    • Email → Converted to HTML with proper styling
    • Slack → Converted to Slack Markdown format
    • Discord → Converted to Discord Markdown format
    • SMS/Push → Shows summary with a link to view the full message
    • And more...

This means you write your message once, and it works beautifully everywhere!

Creating Message Templates

You can create message templates in two ways:

Method 1: From the Events List

  • Navigate to the Events section in the left sidebar
  • Find the event you want to create a template for
  • Click the Add delivery button next to the event
  • In the modal dialog, select a delivery target
  • Fill in all required fields for your selected delivery target (e.g., for Slack, select workspace and channel first)
  • After filling required fields, the Message template option will appear
  • Choose New message template from the dropdown
  • Use the message builder to create your message content using blocks
  • Define a summary for channels with limited display (SMS, Push)
  • Click Save to create both the delivery target and the template

Method 2: From Event Editing

  • Navigate to the event definition you want to create templates for
  • Scroll down to the "Message templates" section
  • Click the New button to create a new template
  • Enter a name for your template
  • Use the message builder to create your message content
  • Click Save to store your template

Message Builder Blocks

The message builder uses a block-based system. Each block represents a different type of content. Currently, MsgGO supports the following blocks:

Text Block

The Text block allows you to add formatted text content to your message.

Features:

  • Supports Twig templating language for dynamic content
  • Can include variables from event data
  • Supports conditional logic
  • Automatically formatted for each delivery channel

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:

  • Displays data from event properties
  • Automatically formats for each channel (where supported)
  • Great for showing lists, logs, or structured data

Configuration:

  • Specify which property from your event data to display as a table
  • The property should contain an array or object

Example configuration:

  • Display table from property: 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"}
  ]
}

Adding Blocks to Your Template

To add a block to your template:

  1. Click Add another block at the bottom of the builder
  2. Choose the block type (Text or Table)
  3. Configure the block:
    • For Text blocks: Enter your content using plain text and/or Twig syntax
    • For Table blocks: Specify the data property to display
  4. Use the arrow buttons to reorder blocks if needed
  5. Click the delete button to remove unwanted blocks

Block Reordering

You can change the order of blocks in your template to control how information is presented:

How to Reorder:

  • Up arrow (↑) - Move the block one position up
  • Down arrow (↓) - Move the block one position down

The order of blocks in the builder determines the order they appear in the final message across all delivery channels. Use reordering to:

  • Put the most important information first
  • Group related content together
  • Create a logical flow for your message
  • Adjust presentation without recreating blocks

Tip: The first block in your template appears at the top of all messages, so place your most critical information there.

Conditional Block Display

You can add conditions to blocks to control when they should be displayed. This is done using the if statement in the block configuration.

How to Add Conditions

To add a condition to a block:

  1. Click the if icon next to the block
  2. A condition builder popup will appear with three fields:
    • Property field: Enter which data property to check (e.g., data.status, data.type)
    • Operator dropdown: Choose the comparison operator:
      • equals - exact match
      • not equals - anything except the value
    • Value field: Enter the value to compare against
  3. Click Save to apply the condition

Example Condition:

Property: data.status
Operator: equals
Value: success
if | data.status equals "success"
  • Show this block only if: data.status equals "success"
  • Show table only if: data.items contains "error"
  • Show warning only if: 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.

Message Summary

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:

  • SMS - Only the summary is sent (SMS has character limits)
  • Push Notifications - Shows in the notification preview
  • Other channels - May be used in previews or mobile views

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.

Auto-Generate Summary (AI-Powered)

MsgGO includes an AI-powered feature to automatically generate summaries from your message content:

How to Use Auto-Generate:

  1. Create your message content with Text and/or Table blocks
  2. Scroll to the Summary section
  3. Click the Auto-generate button (with sparkle icon ✨)
  4. MsgGO will analyze your message blocks and create a concise summary
  5. Review and edit the generated summary if needed

What Auto-Generate Does:

  • Analyzes all text blocks in your template
  • Extracts the most important information
  • Creates a 160-character (or less) summary
  • Maintains the key message and call-to-action

Tips for Best Results:

  • Put the most important information in your first text block
  • Use clear, concise language in your blocks
  • Include key details (event name, status, action required) early
  • Review and customize the generated summary for your specific needs

The auto-generated summary serves as an excellent starting point, but you can always customize it to match your exact requirements.

Summary Best Practices:

  • Keep it under 160 characters
  • Include the most critical information
  • Make it clear and actionable
  • Use the auto-generate feature as a starting point
  • Test how it appears in SMS and push notifications

Using Twig in Templates

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.

Basic Twig Syntax

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 }}

Available Variables

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) #}
  • String timestamp (e.g., "1617183600")
  • Numeric timestamp
  • ISO 8601 date string (e.g., "2023-04-15T14:30:45Z")
  • RFC 2822 date string (e.g., "Sat, 15 Apr 2023 14:30:45 +0000")

Parameters:

  • Format string (default: 'dd.mm.yyyy')
  • Timezone (optional, e.g., 'Europe/Warsaw', 'America/New_York')

Format Options:

The format parameter accepts two types of values:

  • *Presets
  • Predefined format strings:**

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 #}
  • Number of decimal places (2 in example)
  • Decimal point character ('.' in example)
  • Thousands separator character (',' in example)

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 #}
  • Precision (number of decimal places)
  • Method ('common', 'ceil', or 'floor')

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 #}
  • Start position
  • Length
  • (Optional) Preserve keys (for arrays)

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   #}
  • Character mask (optional, defaults to whitespace)
  • Side ('both', 'left', or 'right')

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 #}

Template Naming

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?

  • Unique identification: Each template gets a distinct, easy-to-remember name
  • No naming conflicts: Automatic names prevent duplicate template names
  • Fun and memorable: Quirky names make templates easier to remember than "Template 1", "Template 2"

You can:

  • Keep the auto-generated name
  • Rename the template to something more descriptive (e.g., "Production Deployment Success", "Error Alert Template")
  • Use template names that match your organization's naming conventions

Best Practices:

  • For reusable templates, use descriptive names that indicate their purpose
  • For temporary or test templates, the auto-generated names work great
  • Include context in the name if the template is for a specific use case

Previewing Your Messages

MsgGO provides a preview function that lets you see exactly how your message will look in each delivery channel before sending it to recipients.

How to Preview

From Inbox:

  1. Go to the Inbox section
  2. Find a received event
  3. Click to expand it and select the Deliveries tab
  4. Each delivery shows a Preview button
  5. Click to see the actual formatted message

Best Practices for Message Templates

  • Use blocks wisely: Structure your message logically with Text blocks for content and Table blocks for data
  • Always provide a summary: Even if your primary channels support full messages, some recipients might use SMS or Push
  • Test with real data: Use the "Send event" function to test with actual event data
  • Keep it concise: Even though you can create long messages, shorter messages are often more effective
  • Use conditional blocks: Show different content based on event data to create more relevant messages
  • Leverage Twig: Use filters and conditionals to make your messages dynamic and informative
  • Use descriptive template names: Rename auto-generated names to something meaningful for important templates
  • Reorder for clarity: Put the most important information in the first blocks

Testing Your Templates

Before putting your templates into production, test them:

  • Go to the "Events" section in the left sidebar
  • Find your event in the list
  • Click on the 3 dots button and select "Send event"
  • Modify the test event data if needed
  • Send the test event
  • Check how the message appears in different delivery channels