Improve workflow readability with line breaks
Last Update: Oct 2024 • Est. Read Time: 2 MINYou can create a better experience for your agents by adding line breaks to strings inside of workflows. Adding line breaks makes it easier to parse longer strings and help agents quickly find relevant details.
Who can access this feature? | |
User types | Admins can access the Workflows page. |
In this article
Why use line breaks?
Line breaks help you improve the legibility of code blocks by making it easier to find relevant details within workflow syntax. As a best practice, we recommend adding line breaks anytime you display data to a user from a string attribute.
For example, if your workflow ingests a form hook and creates a message from the data in the payload, you can use line breaks to turn a long paragraph of items into an easier-to-read list.
Add line breaks to workflow JSON
A line break can be created by inserting \n
into the JSON for the workflow. To do this, you must first create the action that will hold the string attribute. For example, you can the Body (string) attribute from a Message: Create workflow action.
To add a line break:
- In the workflow editor, select the desired workflow action you'd like to update.
- Add input to the desired attribute without any line breaks.
- Give the workflow action a distinct, identifiable name by editing the text field above Action Information on the right panel.
- Open the Workflow Options menu and select Edit Workflow JSON.
- Use CTRL+F or CMD+F to open the text search bar, and enter the action name specified in step 3.
- Scroll the Parameters section directly above or below the
"meta": { "displayName": "Action Name" }
code that was found in your search. - Find the attribute that corresponds to the input you specified earlier.
- Add \
n
wherever you'd like to insert a line break. - Select the Update button on the bottom right corner.
- When you're satisfied with these changes, be sure to Save the workflow.
The desired attribute input will now contain line breaks.
Note: Any updates to attributes containing line breaks using the workflow editor will strip out manually-added line breaks. If you make other changes in the inspector panel, it will override these manual styling updates, and you will need to add the line break in the workflow JSON again.