Creating Blocks

In Sendlio, every message is composed of a series of blocks. Blocks are essentially just a snippet of code that can be reused across many different messages. These blocks can be stacked on top of one another and reordered.

Why are blocks important?

Think of blocks as sections of a message. In an email, they might be the header, the body or the footer. In an SMS message, they might be different pre-formatted links. Whatever the content, blocks are important because they are reusable and can be connected to different data sources.

Real-World Use Case

If you have two blogs with the same data structure, you could design a custom block to display the most recent articles. When building an email, you could include the block and connect it to either blog as the data source. Not only that, you'd be able to reuse the block across the different categories in each blog.

Creating a New Block

To create a new block, you first have to place a block into your message. To do this, click the '+' sign in the message preview area.


Next, you'll be presented with a few preset blocks to choose from. Pick one - it doesn't matter which as we'll be editing the code.


Now the block will be placed into the message preview window. When you hover over it, it will get an outline. Click the cog icon in the top right corner of the block to open the block options menu.


You can click "Edit Block" to bring up the code editor and customize the block content then click "Save Custom" to save as a custom block.

Sendlio will ask you to provide a name for your block and then your new block will be available for reuse.

Choosing a Content Source

You can choose from your available content sources to expose variables for use in the code editor. When you connect a content source, the results of the content query are fed into the block when it is rendered.


Code Editor

The code editor allows you to edit the code for your individual blocks. Sendlio uses a templating language called Twig.  If you're faimilar with the Symfony PHP framework then using Sendlio's templates will be second nature. Twig is very versatile and similar in many ways to the Liquid syntax.

Read more about the code editor and how to use variables here.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us