How to generate and send by mail reports using FlowEngine?
Introduction
In FlowEngine, you can send emails using the "onesaitplatform-mail" node. Its use is shown at Mail Service & Mail FlowEngine Component.
Additionally, in the FlowEngine, HTTP requests can be made using the "HTTP request" node.
From there, you can generate reports using the control panel APIs and send them by e-mail.
Example
The flow is as follows:
In the "msg" node, enter the parameters for the REST API call (Authorization and the parameters to be entered to generate the report):
These parameters will be the same that must be filled in when generating the report:
In the node "Add attachment", pass the result of the previous call in the msg.payload.filedata field:
Finally, configure the mail node with the previously described parameters:
When starting the flow, the report will be generated from the selected template and sent by e-mail:
If you want to externally enter the parameters of the mail ("to", "subject", "filename", "body" or "htmlenable"), the scheme to follow will be this:
In the "Add body" node, you must add the fields of the mail node that you want to configure. If any of the parameters is not included, the value from the onesaitplatform-mail node will be used.
Lastly, in the join node, the two payloads must be combined with the following configuration: