template

Insert one document into another

Definition

string template(string $id, string $stage, object $data)

Generate a Documotor document by finding the recipe with ID $id on stage $stage, and generating a document from it based on $data. The document is outputted as a base64 string. This document is referred to as a text element, and can be inserted into your current template by using a TextElement or a SlideElement binding.

Parameters

string $id

ID of the recipe that needs to generate the document. Can be found in the URL when the recipe is open, as the portion of the URL following the last slash.

string $stage

The stage of the recipe for the document that needs to be inserted. Set to null if template has no stage.

object $data

JSON object to provide as the input data for generation of the document from the recipe.

Returns

string

The base64 representation of the generated document. Can be inserted into a document with a TextElement or a SlideElement binding in Word or PowerPoint respectively.

Examples

{
  a: template('65367b97833eb0d06f3eca1f', '626252489afd95fbc534d345', @)
}
{
  a: "UesDBBQABggIAAAAIQAjAicNcGEAA10GAAATAAgCW0N..."
}