file.load

Load a text file from your app's code repo and store it in
(@ flow.result ) in the flow scope.

You can also treat this text file as a template file that includes
Meya template tags that can
be rendered using a template context dictionary.

This component is particularly useful when you need to send HTML emails
and would like to use an email template to standardize the email design.

The following example will load the templates/email.html template file
and render it using the Meya template syntax. The template_context gets
made available to the template rendering engine so you would
be able to reference the user's name using (@ name ).

steps:
  - file_path: templates/email.html
    template: true
    template_context:
      flow: (@ flow )
      name: (@ user.name )
      email: (@ user.email )
      foo: bar

template/email.html

<html>
  <body>
    <p>
      Hi, (@ name )
    </p>
    <p>
        This is to notify you that your email address <b>(@ email )</b> has
        been changed to <b>(@ flow.new_email)</b>
    </p>
    <p>
        Thanks!
    </p>
  </body>
</html>

Element details

type: meya.file.component.load
class: FileLoadComponent
path: /meya/file/component/load.py
signature: file_path

Fields

field

description

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

required

signature

default

type

spec

Override the original spec for this element.

null

Spec

context

Send context data with this component's event.

{}

dict

sensitive

Mark this component's event as sensitive. This will encrypt the event if the Sensitive Data integration has been enabled.

false

bool

triggers

Activate these dynamic triggers when the component runs. Check the component triggers guide for more info.

[]

list

file_path

The file path relative to the app's root folder.

str

template

The file must be rendered using the Meya template syntax.

false

bool

template_context

Optional context variables used in the template.

null

dict

Usage reference

Basic

triggers:
  - keyword: meya.file.component.load
steps:
  - file_path: STRING

Full

triggers:
  - keyword: meya.file.component.load
steps:
  - spec:
      type: STRING
      data:
        STRING: ANY
      timeout: 123
      trigger_when: ANY
    context:
      STRING: ANY
    sensitive: false
    triggers:
      - type: STRING
        data:
          STRING: ANY
        timeout: 123
        trigger_when: ANY
    file_path: STRING
    template: false
    template_context:
      STRING: ANY