Create Connect+ Templates - DIY Templates

You can create dataflows using Neo extensions to build payloads for APIs, used in Connect+ to create DIY templates. These dataflows receive input in JSON format and convert it into the desired API payload.

The section below provides steps to create a Neo dataflow for building a custom payload.

Create a Neo dataflow

Suppose you need to create a payload for adding customers through the Add Customer API.

To achieve this, through the Neo dataflow you need to do the following:

  1. Extract the mobile number and external ID from the Transform-Data block in JSON format.
  2. Build the profile object with identifiers and commChannels, and return a JSON payload for Add Customer API.

Follow the steps below to create the Neo dataflow in the Neo Extensions UI.

  1. Create new dataflow

    1. Go to the Neo extension UI and click Create new dataflow.
    2. Enter a name for the dataflow.
    3. Enter the tag name as connectplus.
    4. Click Done.
    5. In the Neo extension UI, select the dataflow you created.
    6. On the dataflow page, click on version v1.
      Note: A new dataflow has only version v1.
  2. Define an API Trigger

    1. Open the version of the dataflow you want to edit.
    2. Modify the Trigger block on the canvas to configure the API.
    3. Set the API method to POST.
    4. Enter API url.
    5. Click Done.
  3. Create a Java script block to create the payload

    1. Enter the block name in Block name field.
    2. In the Script section, implement the execute method to create the profiles object and retrieve the mobile and externalId using the getIn() DAO function .
    3. Create the commChannels object and add the communication channel details.
    4. In the Combine inputs to this block using section, select the radio button for AND operator, as the block depends on the output of the previous block.
    5. In the Relationssection, under Path 1 Relationuse the DAO function isSuccess() to handle successful outcomes.
    6. Click Done.
      The following is the code snippet illustrating the Java Script block.
    import dao from "neo/dao";
    import logger from "neo/logger";
    //These are some dao methods already imported. 
    //Other methods on dao you can use by typing `dao.` and editor will suggest few available methods.
    const {
        getBody,
        getEffectiveHeaders,
        getIn,
        getApiRequest,
        getOut,
    } = dao;
    
    
    const script = {
    
        execute: () => {
    
            //Write your code here.
            return {
      "profiles":[
        {
          "identifiers":[
            {
              "type":"mobile",
              "value":getIn().mobile
            },
            {
              "type":"externalId",
              "value":getIn().externalId
            }],
          "commChannels":[
            {
              "type":"mobile",
              "value":getIn().mobile,
              "primary":false,
              "verified":false,
              "subscribed":false,
              "attributes":{
              }
            }]
        }]
    };
    
        }
    }
    
    export {
        script as default
    }
    

    You have created the Neo dataflow that generates the payload to add customers.

This payload is forwarded to the Connect-to-Destination block to call the API.

For detailed information on the Connect+ DIY template, refer DIY Templates.