An OL Connect email flow in Node-RED
This topic explains which nodes and files are used in a typical OL Connect email flow in Node-RED.
Tip: Example email flows are provided by OL Connect Automate, once installed. The examples appear in the flows folder in the Import dialog in Node-RED which allows you to import an example flow into a new or existing flow; see Importing and Exporting Flows in the Node-RED documentation. Instructions are given in the Comment node.
Alternatively, an easy way to get the files that the typical OL Connect email flow needs, is to create a Sample Project (see Sample Project: Basic Email). You would use all files except the Workflow configuration file.
The structure of an OL Connect email flow
In its simplest form, an email flow may consist of a node that captures data, the email content node to generate email content and a node to send the messages via an Email Service Provider (ESP) like SendGrid.
The email content node creates a set of emails, using the Email context in a Connect template.
The data to merge the template with can be the output of (a combination of) nodes like:
- An OL Connect folder capture node.
-
An OL Connect data get node which retrieves an existing record set from the Connect database.
-
An OL Connect data mapping node which retrieves data from a data file.
-
A standard node like the http in node, the inject node, or a create file node that creates a JSON file.
-
Etc.
Which node or nodes fit best, depends on where the data come from.
Tip: If the template doesn't need any data, set msg.payload
of the email content node to an empty JSON string: {}
.
Tip: A number of nodes accept runtime parameters. These can be passed via the parameters
property of the msg
object which is passed between nodes. For example, a runtime parameter named brandId would be passed via msg.parameters.brandId
. Use a function node or change node to set the property.
Files used in an OL Connect email flow
Before creating the email flow in the editor of Node-RED you will need to create:
-
A template with an Email context. (See Creating a template.)
-
If the email should contain variable data, you may need to create a data mapping configuration (see Creating a new data mapping configuration). If the input is going to be JSON data, you could add them to the design without a data mapping configuration, using a JSON file (see Adding JSON sample data).
Note that before templates and data mapping configurations can be used in a flow, they must be sent to the OL Connect server separately. This can be done from the Designer (see Sending files to Connect Server or to another server) or in a startup flow (see OL Connect Startup flow).