Our template builder supports several utility steps. These provide the necessary help and functionalities that are not supported by general Actions and Triggers.

We have discussed the details of the CSV App and how it is used as a template step here. In this article, we’ll discuss the File Append App and how it functions in correlation to the CSV step. It is recommended that you go through the documentation for the CSV app first, as that will make the File Append app much easier to understand.

File Append app

The file append app is used to write input data onto a file of any specific type. That file is stored in the Integry cloud storage. This action type step usually goes hand-in-hand with the CSV app, as the output CSV text has to be written onto a file before it can be used in different operations for apps. To add a File Append step in your template, add an action step and select “File Append App” from the list of apps.

Select the “Append File” action type that is the only available action type in the file append app.

In the configure fields section of this step, you need to provide a file name, file extension, and the input data to be written on that file. Those will be discussed in the example that is discussed below.

Example in a template

Let us recreate the template example that we discussed for the CSV app, and show you how the File Append step is used along with it. Consider that you have an integration of Salesforce contacts with Sendinblue. When the integration is created, all your contacts will be imported from Salesforce to Sendinblue. The simplified workflow of these steps in the template will look similar to what is shown below.

Recapping the overview of this example, most apps don’t support the creation of multiple contacts through a JSON input. As the query step at step 0 imports all the contacts from Salesforce in a JSON format, it needs to be converted to a CSV file, so that it can be uploaded and imported to Sendinblue. The CSV App at step 0.0 converts that data to CSV format. The output of this step will look like what is shown below.

Output:

{ 

"email,LASTNAME,FIRSTNAME\r\nrose@example.com,Gonzalez,Rose\r\nsean@example.com,Forbes,Sean\r\njrogers@example.com,Rogers,Jack\r\nbarr_tim@example.com,Barr,Tim\r\nbond_john@example.com,Bond,John\r\nspavlova@example.com,Pavlova,Stella\r\nlboyle@example.com,Boyle,Lauren"

}

After the JSON data for imported contacts is converted to the CSV format, it will need to be written onto a file so that it can be used in the operation of bulk importing contacts in Sendinblue. For that, add the File Append step at the index 0.0.1.

In the configure fields section of this step, you will first need to provide a file name. If the file name is unique and that file does not exist in our cloud storage, a new file with that name will be created. If a file with this name previously exists in our cloud storage, the text lines of the input data are appended to the previously written text in that file.

For the current example, a unique file name has to be provided so that a new file for the imported CSV data can be created. For that, we use the tag {trigger.instance_id} in our templates which generates a unique file name every time. This will make sure that your file is always a unique file and does not interfere with other files in our file storage. 

After giving a unique file name, you need to provide the file extension. It can be any type of file that you require. For this example, the file type used is CSV.

Lastly, you have to provide the actual data that needs to be written in the file. For this template, the variable {steps.0.steps.0.out} is provided. steps.0.steps.0 refers to the first child step of step 0. That is the previous step of CSV app, out means the output of this CSV step that was shown above. So, the file append step will write that above output onto a file. The appended file data will look as shown below.

Output:

File: 

email,LASTNAME,FIRSTNAME

rose@example.com,Gonzalez,Rose

sean@example.com,Forbes,Sean

jrogers@example.com,Rogers,Jack

barr_tim@example.com,Barr,Tim

bond_john@example.com,Bond,John

spavlova@example.com,Pavlova,Stella

lboyle@example.com,Boyle,Lauren

The above two child steps (0.0 and 0.1) of the query will keep running until all the pages of the imported data are converted into the CSV format and appended onto a file. When the query is done importing all the data, the output will be completely converted into a CSV file.

Now the above CSV file will be accepted as the input of Step 1 which is the action of importing and creating the above contacts in Sendinblue. This CSV file will be populated in your Sendinblue account as the contacts that you imported from Salesforce.

This is how the File Append app serves its functionality and its correlation with the CSV App for most use cases has also been made apparent here. 

Learn how to map data using Objects in your templates. An overview for creating your own templates is provided here.

Did this answer your question?