> For the complete documentation index, see [llms.txt](https://docs.rierino.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.rierino.com/devops/api-event-and-process-flows/configuring-saga-steps/event-step/core-actions/generate-text-html.md).

# Generate Text/Html

## Generate Text/Html Actions

### ApplyTemplate

Produces text (e.g. plain, html) from given input data and template id. Event metadata fields applicable for this action are as follows:

{% tabs %}
{% tab title="Table" %}

| Field          | Definition                                         | Example  | Default |
| -------------- | -------------------------------------------------- | -------- | ------- |
| Input Element  | Json path for the input in request event payload   | customer | -       |
| Output Element | Json path for the output in response event payload | html     | -       |
| {% endtab %}   |                                                    |          |         |

{% tab title="JSON Schema" %}

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "eventMeta": {
      "type": "object",
      "properties": {
        "inputElement": {
          "type": "string",
          "description": "Json path for the input in request event payload",
          "example": "customer"
        },
        "outputElement": {
          "type": "string",
          "description": "Json path for the output in response event payload",
          "example": "html"
        }
      }
    }
  }
}
```

{% endtab %}
{% endtabs %}

With event metadata parameters as:

{% tabs %}
{% tab title="Table" %}

| Parameter        | Definition                                       | Example             | Default |
| ---------------- | ------------------------------------------------ | ------------------- | ------- |
| Template ID      | Id of the template to use from code.state        | landing\_page       | -       |
| Template ID Path | Json path of the template in event payload       | parameters.template | -       |
| Result Path      | Json path to add produced text on output element | output              | result  |
| {% endtab %}     |                                                  |                     |         |

{% tab title="JSON Schema" %}

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "eventMeta": {
      "type": "object",
      "properties": {
        "parameters": {
          "type": "object",
          "properties": {
            "templateId": {
              "type": "string",
              "description": "Id of the template to use from code.state",
              "example": "landing_page"
            },
            "templateIdPath": {
              "type": "string",
              "description": "Json path of the template in event payload",
              "example": "parameters.template"
            },
            "resultPath": {
              "type": "string",
              "description": "Json path to add produced text on output element",
              "default": "result",
              "example": "output"
            }
          }
        }
      }
    }
  }
}
```

{% endtab %}
{% endtabs %}

<details>

<summary>Example</summary>

Input

```json
{
    "parameters": {
        "course": "Rierino 101",
        "chapters": [
            {"name": "Introduction"}
        ] 
    }
}
```

Event Metadata

### ![](/files/zkMQRL71yiY2RX7zBLgq)

</details>

### ApplyTemplateList

Produces text from a given array of input data and template ids. Event metadata fields applicable for this action are as follows:

{% tabs %}
{% tab title="Table" %}

| Field          | Definition                                         | Example | Default |
| -------------- | -------------------------------------------------- | ------- | ------- |
| Input Element  | Json path for the input in request event payload   | list    | -       |
| Output Element | Json path for the output in response event payload | html    | -       |
| {% endtab %}   |                                                    |         |         |

{% tab title="JSON Schema" %}

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "eventMeta": {
      "type": "object",
      "properties": {
        "inputElement": {
          "type": "string",
          "description": "Json path for the input in request event payload",
          "example": "list"
        },
        "outputElement": {
          "type": "string",
          "description": "Json path for the output in response event payload",
          "example": "html"
        }
      }
    }
  }
}
```

{% endtab %}
{% endtabs %}

With event metadata parameters as:

{% tabs %}
{% tab title="Table" %}

| Parameter        | Definition                                                    | Example | Default |
| ---------------- | ------------------------------------------------------------- | ------- | ------- |
| Output Structure | Structure of output to produce (map[^1], array[^2], text[^3]) | map     | -       |
| Output Delimiter | Delimiter for concatenating results if structure is "text"    | \n      | -       |
| Input Path       | Json path to get list of requests from                        | list    | input   |
| Result Path      | Json path to add produced text on output element              | output  | result  |
| {% endtab %}     |                                                               |         |         |

{% tab title="JSON Schema" %}

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "eventMeta": {
      "type": "object",
      "properties": {
        "parameters": {
          "type": "object",
          "properties": {
            "structure": {
              "type": "string",
              "description": "Structure of output to produce (map, array, text)",
              "enum": ["map", "array", "text"],
              "example": "map"
            },
            "delimiter": {
              "type": "string",
              "description": "Delimiter for concatenating results if structure is \"text\"",
              "example": "\\n"
            },
            "inputPath": {
              "type": "string",
              "description": "Json path to get list of requests from",
              "default": "input",
              "example": "list"
            },
            "resultPath": {
              "type": "string",
              "description": "Json path to add produced text on output element",
              "default": "result",
              "example": "output"
            }
          }
        }
      }
    }
  }
}
```

{% endtab %}
{% endtabs %}

[^1]: {section:\[{templateId, result}]}

[^2]: \[{section, templateId, result}]

[^3]: Concatenated result text


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.rierino.com/devops/api-event-and-process-flows/configuring-saga-steps/event-step/core-actions/generate-text-html.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
