This is a detailed guide on the adapter step in templates. The details on how to create the adapter activity in the app creator can be found here

An adapter step is used to take a list of objects from an API endpoint, that might contain custom attributes as well and allow the end-user to specify their own mapping. Effectively, an adapter maps the input data based upon what the user selects in the mapping step of the integration. The adapter takes an input array of data and transforms it into a shape that is required to perform a specific operation on it.

Suppose that you want to import the data of multiple contacts for a user from MailChimp. This action is known as bulk import. When creating the integration, the user will provide a basic mapping to match the attributes of his app with the external MailChimp attributes. From the user’s end, this will look similar to what is shown below.  The user could decide to map SMS with the Phone field, might skip mapping the FIRSTNAME field and map the LASTNAME with LAST NAME field. This user-defined mapping is applied using the adapter step. So typically, in the template, an adapter is applied to the Query step to transform it to the user's needs

This mapping information is collected by an adapter which then maps these attributes with the actual data stored inside the corresponding MailChimp attributes. The input JSON array and the mapping of corresponding data on the backend will be shown for this example later in this document.

Adapters are similar to the filter step in nature. The difference is that adapters are used for the initial mapping of objects between two apps, while filters are used for mapping in the opposite direction as well as for applying other basic data transformations.

An adaptor step can be added to the template just like any other step. Create a new template or open an already created template. Add a new step through the Add Step button as shown below.

You can find the adapter step option in the list of available steps.

The simplified form of the adapter step in the template for importing your contacts from MailChimp to your app will look like this:

The step 0 is the query step which imports the contacts and their attributes from MailChimp. This is the step where the actual values of MailChimp contact attributes are stored. Step 0.0 is the adapter step where your app’s (Sendinblue in this image) attributes are mapped with the values of corresponding MailChimp attributes. The output of the step 0.0 is converted to the CSV format and written on a file. That file is taken as input for the contact information in Step 1. This step then creates the imported contacts in Sendinblue (your app).

The fields’ configuration upon expanding the adapter step in the above example will be as shown below.

The “Input Array” field is where the variable for the input array can be provided. This is the array that contains the values of the third-party app (MailChimp in case of the running example) attributes for the imported contacts. So the variable for the object output for the step 0 is provided here. The email and list fields are also collected separately from the user.

The “Attributes” field is where the mapping data will be collected by the user. So this step can be left blank in the template. This is the integration creation step where the user provides the MailChimp attribute names for contacts corresponding to the attributes of his app. The image from the user’s end for this is shown at the start of this document.

Every template can have multiple adaptors. Learn more about creating your own templates.

Did this answer your question?