What is Formatter?

Formatter is a built-in app by Automate.io. You can use it to convert data into a different format before adding it to another app in your Bot. 

Where can I find Formatter on Automate.io?

You can find Formatter while you are creating a Bot. To use Formatter, first, add a Trigger app to your Bot. Then, select Formatter from the Apps list.

What type of data can I convert using Formatter?

With Formatter, you can tweak text, numbers, and dates in so many ways to get them in the format you need.

It supports the following actions:

  • Format Text - Perform text operations like splitting, replacing, capitalizing, etc
  • Parse Data - Extract specific data from a blob of JSON/XML data.
  • Format Date - Convert date & time into another format, time zone, etc.
  • Format Number - Change how you want numbers to appear.
  • Lookup Table - Match usernames, numbers, etc. with related fields to find the relevant data.

Note: Since Formatter only converts data coming from another app in your Bot, it doesn't support any triggers. 

Now, let's learn about these actions in detail.

Format Text

Using Format Text, you can clean up any text value with the help of the following operations.

Split Text
This operation splits a given text based on a letter or word or special characters like space, new line, or tabs.

  1. Under Operation, select Split Text. You'll see relevant fields below it.
  2. Select the text that you want to split in the Text field.
  3. Under Separator, enter a character or word or a special character (see section Codes for Special Characters below) on which you want to split the text. By default, [:space:] is the special character.
  4. Under Position, select the segment of the split text you want to use. You can also specify a custom index number using the ‘custom value' option. The text that you want to use gets stored in Split Text in Output Fields.

Let's see when this operation can come in handy.

Example: Say you want to send data from a specific trigger app to a CRM, and the trigger app outputs the customer name only as 'Fullname'. However, every CRM requires the customer name separately as 'First Name' and 'Last Name'. 

The above example is a perfect case to make use of Split Text in Formatter. Using Split Text, you can split Fullname into First Name and Last Name, and move them to your CRM without any hassle.

Replace
This operation allows you to find text (character, word, phrase) and replace it with any other text. 

  1. Under Original Text, select the text field.
  2. Find the text that you want to replace. 
  3. Enter the new text that you want to replace the above text with. You can leave this empty if you wish to just remove the above text.  
  4. The updated text is stored in Replaced Text under Output Fields.

You can also replace special characters using this operation. Check out the section Codes for Special Characters below for more help.

Codes for Special Characters
[:space:] - for spaces (\s)
[:newline:] - for new lines character (\n)
[:tab:] - for tab space character (\t)
[:return:] - for carriage return character (\r)
[:blank:] - for specifying nothing 

These codes are supported for the following operations:

  • Split Text - for Separator field 
  • Replace - for Find and Replace with fields

Trim Text
Trim Text operation removes spaces at the beginning and the end of the text.

Cut Text
This operation slices and extracts a chunk of text from the given input text. 

  1. Under Text, select the text field.
  2. Enter the start index (start position) from where you want the text to be extracted. You can leave this blank if you want the start position to be the beginning of the text.
  3. Enter the end index (end position). You can leave this blank if you want to cut till the end of the text.
  4. The output will be a chunk of text that begins from the Start Position up to but not including the End Position. And it will be stored in Cut Text under Output Fields.

Example: Let's say you want to cut the part, 'wock' from the text, 'Jabberwocky'. The index of the letter 'J' is 0, that of 'a' is 1, that of the first 'b' is 2, second 'b' is 3 and so on. Similarly, the index of the letter 'y' will be 10. To cut 'wock', enter the Start and End positions as 6 and 10 respectively. 

Extract Number
Finds the first number in the given text and extracts it. 

Extract URL
Finds a URL in the given text and extracts it.

Extract Email
Finds an email address in the given text and extracts it.

Match Regular Expression

A regular expression allows you to find matches in a text without being specific on the exact text you are looking for.

Say you regularly get emails containing phone numbers, email addresses, or links, and you would like to separate them and use them. You can either do a manual copy & paste work or let Formatter's Match Regular Expression automatically do that for you.

Let's see how to use this operation in your Bot.

  1. Under Regular Expression, give a pattern of text to match, i.e., enter the kind of text that you are searching for here. For example, if you want to search for email addresses, type the regex script, ([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5}). With this, any text that matches this pattern gets returned as output.  
  2. Under Text, enter the text or field from which you would like to find a pattern. For example, this field can have the body field of your email from Gmail.  
  3. Automate.io finds a match, extracts the text, and saves it in the Matched Text field. You can pass this extracted data to another app in your Bot.

For more info on regular expressions and regex scripts, visit this page.

Lower Case
Converts every letter in a given text field into lower case.

Title Case
Capitalizes the first letter of every word.

Extract Text from HTML
Removes all the HTML tags and leaves just the plain text.

Important: For every text operation, the converted data will be stored in the Output Fields in the Formatter app.

Parse Data

Formatter's Parse Data action can be used to extract specific data from a blob of JSON/XML data. This action is ideally used in conjunction with Webhooks or any other app that provides JSON/XML data as output. To learn how to use the Parse Data action in your Bot, visit this page.  

Format Date

Different countries have different ways of listing dates & times. The same is the case with the apps we use every day—each one of them has their own way of showing date & time. If Stripe says that a payment has been made at 17:30:25 Aug 26, 2019, your Shopify store could say that the same order was made on Monday, 26 August 2019 at 5:30 PM. 

Also, with many time zones across the world, it can get confusing to work with all of that data. 

Format Date removes those hurdles and allows you to customize date & time into the format you want automatically. It can also convert the input time into a different time zone.

Let's learn how Format Date works. Say you have a date & time field coming from Google Sheets, and you want to convert that into a specific format. 

  1. Under Input Date/Time, put the field that you want to convert.
  2. You can optionally specify the format of the above date & time field. If you are unsure about it (or if the format option is missing in the drop-down), you can leave it as Auto Detect. The system understands a wide variety of formats, even human-readable formats like 'next monday 5pm'.
  3. Under Target Format, from the drop-down, select the format you wish to convert it to. In most cases, what you may want is to convert it into Automate.io's standard format (which is provided in the drop-down) so that it can be used as an input in a subsequent action. However, if you are looking for some other format not provided in the drop-down, you can choose the Use Custom Value option and provide your desired format. You can look up for the formatting options here. Look for the desired tokens for a year, month, day & time 
  4. Select the target time zone you want the date & time to be.
  5. The Formatted Date/Time is the field that stores the converted date & time. Once you've set up this step, you can continue setting up the rest of your Bot by adding more actions. Be sure to use this output further in your Bot.

Format Number

The Format Number action allows you to choose a symbol for grouping and decimal place in a number. 

For example, let's say you have a number 123,456.789 and you want to convert the grouping into 123 456 789. This can be done using the Format Number action in your Bot. Let's see how to do that.

  1. Input the number that needs to be formatted. The maximum digit limit here is 15.
  2. Under Input Grouping Symbol, choose the delimiter from the drop-down that is used before each third digit from the left. For example, if the number is 45,875.54the delimiter here is a comma.
  3. Under Input Decimal Symbol, choose the delimiter from the drop-down that is used to separate the decimal numbers. In the previous example, in the number 45,875.543, the delimiter is a period.
  4. Under Output Grouping Symbol, select the delimiter that you want from the drop-down.
  5. Similarly, under Output Decimal Symbol, select the delimiter to separate the decimal numbers.
  6. The output number is saved in the Formatted Number field. You can pass this to any other apps in your Bot.

Lookup Table

The Lookup Table action comes in handy if you need to dynamically select a value from a set of values based on some input data. This is particularly useful if two apps that you are working with have different terminology when referring to the same thing.

For example, let's say your Trigger app only passes on a name, but your Action app needs the ID of that name. You can create a list of records your Trigger can search for and then pass on the correct value to that Action app using the Lookup Table.

Visit this page to learn how to use Lookup Table in your Bot.

Did this answer your question?