Skip to content

Payload Handling

Most AWS actions require data to be sent, whether it’s the JSON body for a Lambda function or the message body for an SQS queue. myna standardizes how you define this data using the [payload] block.

The [payload] block supports two mutually exclusive fields: data and file.

FieldTypeDescription
datastringInline content (string or JSON). Supports variable interpolation.
filestringPath to a file containing the payload. Relative to the action file.

Precedence: If both are present, file takes precedence.

Use the data field for simple, self-contained payloads. Multi-line strings in TOML (""") make this easy for JSON.

[payload]
data = """
{
"user_id": "{{USER_ID}}",
"action": "create"
}
"""

Inline data automatically supports Handlebars-style variable substitution ({{VAR}}).

[pre]
ENV = "dev"
[payload]
data = "Processing in environment: {{ENV}}"

For larger or binary payloads, use the file field.

[payload]
file = "./payloads/large-event.json"
  1. Relative Path: If the path is relative (e.g., ./data.json), it is resolved relative to the Action file’s directory.
  2. Absolute Path: You can provide a full absolute path (not recommended for sharing code).
  3. Variable Substitution: Content loaded from files also supports variable substitution.
payloads/large-event.json
{
"complex_object": {
"id": "{{ID_FROM_VARS}}"
}
}