In addition to integrations, we provide you with utilities that make integration flows easy. Developing a complete integration workflow through the template builder is not as straightforward as a trigger and an action step. Each integration template is different and caters to the uniquely specific requirements for the apps used in it. To fulfill these various requirements, we have created several utility steps, that we simply call special steps in the template builder. They provide the necessary help and connections between activities in the template workflow.

In this article, we’ll discuss the CSV app and how it functions.

The CSV App

The CSV App serves the basic purpose of taking various formats of input data and transforming it to a CSV format as output. This action type step has been introduced in our template builder because many apps like Sendinblue only perform the initial bulk import of data (like contacts) from other apps if they receive the imported data in the form of a CSV file. The data we import from other apps in integrations is in the format of a JSON array. So the CSV app converts that input format to CSV.

To add the CSV App step in your template, add an action step and select “CSV App” from the list of apps.

Currently, there is only one action type, JSON to CSV. The JSON format is the most common format that is used to transfer data through APIs. Select that action type from the list.

In the field configuration for this step, you have to provide the CSV Delimiter that separates the values in the CSV file. That is mostly the comma (,) character. In the “JSON Text” field, you have to provide the input JSON array. Here, you can provide the template tag of any other step that generates your target JSON array as output.

If we see an example, let's say we have the following input JSON array, that is generated from importing one contact Object to Integry from some other app.

[

{

“contact_v1”: {

"first_name": "John",

"last_name": "Smith",

"address": {

"state": "California",

"country": "US"

},

"age": 20,

"verified": true

}

}

]

After going through the conversion in this step, the resulting CSV output will be:

“contact_v1__first_name,contact_v1__last_name,contact_v1__address__state,contact_v1__address__country,contact_v1__age,contact_v1__verified

John,Smith,California,US,20,true”

This step will be shown in an example with other template steps in the next section.

Example in a template

Let us discuss an actual example of the CSV app in a template. It is mostly used together with the file append step, as the CSV data has to be written onto a file after conversion. 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.

The contacts are first bulk imported from your Salesforce account through a paginated query in step 0. So this step will provide output as JSON text in a page-by-page manner. This text will contain the attributes of multiple contacts imported from Salesforce. An example of the first page of this query output is shown below.

 [

 {

    "email": "rose@example.com",

    "LASTNAME": "Gonzalez",

    "FIRSTNAME": "Rose"

    }, {

    "email": "sean@example.com",

    "LASTNAME": "Forbes",

    "FIRSTNAME": "Sean"

    }, {

    "email": "jrogers@example.com",

    "LASTNAME": "Rogers",

    "FIRSTNAME": "Jack"

    }, {

    "email": "barr_tim@example.com",

    "LASTNAME": "Barr",

    "FIRSTNAME": "Tim"

    }, {

    "email": "bond_john@example.com",

    "LASTNAME": "Bond",

    "FIRSTNAME": "John"

    }, {

    "email": "spavlova@example.com",

    "LASTNAME": "Pavlova",

    "FIRSTNAME": "Stella"

    }, {

    "email": "lboyle@example.com",

    "LASTNAME": "Boyle",

    "FIRSTNAME": "Lauren"

    }

]

As talked about before, the Sendinblue app doesn’t support the creation of multiple contacts through a JSON input. So you will need to convert the above query output into a file of CSV format. For that, add the CSV app step as a child of the query as shown in the image.

The fields configuration for this step will look similar to this:

The comma (,) character is given as the CSV delimiter to separate the values. In the JSON Text field, the variable {steps.0.obj_json} is provided. The step 0 is the query step and obj_json is the JSON output of this query in the form of Objects.

This step will convert the JSON output of the query step into a CSV format as 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"

}

So, converting the JSON data into the above format is what the CSV step is used for. After the conversion of this data, 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, the File Append step can be used. The details of that along with this same example are discussed separately here.

Read more on how to create your own templates. You can store and retrieve values in a template using the Storage app.

Did this answer your question?