Skip to main content
Action: Format Output
Updated over 4 months ago

Overview

The Format Output action allows you to consolidate multiple outputs from a workflow into a single formatted output template. This action is incredibly useful for managing complex workflows that generate various types of content like text summaries, social media posts, image descriptions. By formatting these disparate outputs into one coherent template, it becomes much easier to consume, share and integrate the workflow's output with other systems or channels. Common use cases include formatting outputs for sending notification emails, generating structured data formats like JSON for integration with APIs, and simply making workflow outputs more readable and presentable.

Usage Examples

  • Format Email for Blog Post Promotion - Workflows can automate several tasks related to promoting a blog post across different channels. A workflow can take a blog post URL as input, scrape the content, generate a summary, create social media posts (LinkedIn, Facebook, Instagram) along with an accompanying image, and finally format all these outputs into a single email using the Format Output action. The formatted email can contain the blog summary, social posts, and the generated image. This email can then be sent out as a notification, providing a clean and organized view of all the promotional assets generated for the blog post.

  • Structure Outputs for Use with an API - The Format Output action can be used to structure the output of a workflow into a specific format, like JSON, which can be consumed by other systems or APIs. A workflow can determine target audiences for a given blog post, generate three separate LinkedIn posts tailored for each audience, and then use Format Output to create a JSON structure containing the blog URL and the three LinkedIn posts. To ensure the JSON is valid, the output can be passed through a "Validate JSON" step which handles proper character escaping and formatting or even with an external JSON validation tool. This formatted JSON output can then be easily integrated with other APIs or systems that expect the data in this specific structure.

Inputs

  • Format - the mode to use when formatting the output.

    • Plain Text - allows you to create a format structure in plain text and insert data into that structure. Using the Plain Text option, you can design a well formatted HTML or Markdown document with your text input for a more human readable output.

    • JSON - is great for mapping raw data into structured JSON templates. This allows you to perform advanced actions such as scraping a PDF document and passing in the raw text to be organized into the relevant structural locations within the JSON template, turning raw text into a more consumable JSON format.

  • When Plain Text is chosen for Format, you’ll have the following inputs:

    • Output Template - input the formatting template structure that you want the action to output. Here, you can design the template and selectively any data your output requires pressing # .

  • When JSON is chosen for Format, you’ll have the following inputs:

    • Input Data - insert the data you are looking to format into JSON (press # and adding one or more data points).

    • Schema of your output - describe or paste in an example of the JSON schema you want. For example, if you wanted to extract the character names, personalities, and roles from a chapter in a book you could use an example like this:

      {"Characters"=[ {"character1":{ "name":"", "personality":"", "role":"" },{"character2":{ "name":"", "personality":"", "role":"" },{"character3":{ "name":"", "personality":"", "role":"" },{ etc. }

      Give it a try by installing this template and then pasting in the first chapter from a public domain book like Pride and Prejudice.

Advanced Inputs

This action does not have any advanced inputs.

Outputs

The primary output is the formatted result of your Plain Text or JSON structure with any data that as passed in. The specific output will vary widely depending on the specific use case and workflow configuration.

Troubleshooting

  • Formatting Support - When using the Format Output action to format outputs into an email body, it's essential to consider the email platform's support for the chosen formatting syntax. For example, if you are using Markdown syntax for formatting, be aware that not all email platforms support Markdown. To ensure consistent formatting across email platforms, it is recommended to use HTML formatting instead of Markdown when formatting emails with the Format Output action.

  • JSON Validation - The Format Output action can be used to generate JSON structures from multiple outputs, which can be useful when integrating with APIs that expect specific JSON formats. However, when generating JSON structures, it's crucial to ensure that the resulting JSON is valid by properly escaping necessary characters (e.g., spaces, commas) that may break the JSON structure. Best practices also recommend using a JSON validator tool to verify the validity of the generated JSON structure before integrating it with other systems or APIs.

Related Actions

  • Send Notification Email - This action sends a notification email containing the formatted output from the workflow. It is particularly useful when you want to share the results of a complex workflow, such as a well formatted report or a blog post summary and its associated social media posts and images, in a clean and easily readable format. By using the format output action to combine all the outputs into one cohesive structure, and then passing that to the notify email action, you can receive a nicely formatted email containing all the relevant information.

  • Translate Text with AI - The Transform Text action enables you to perform various text manipulation operations on input text using programmatic methods. It provides a range of transformation options like replacing text using regular expressions, splitting text into an array based on a delimiter, calculating text length, truncating text to a specified character count, converting text to uppercase or lowercase, and joining array elements into a single text string. This action is useful for common text processing tasks that are better suited for programmatic operations rather than relying on AI generation. It allows you to clean up, reformat, and manipulate text inputs as needed before being passed into a JSON template, for example.

Did this answer your question?