Pivot On N8N

Hi,

I am working on data formating and i have a list of domain names with me ( which are duplicted as well).

I am trying to do a pivot table using N8N to find the unique domain names with the count.

Is there a way or a node i can use to achive this, just the way we do regular pivot on excell?

Thanks,
Sathya.R

Hi @Sathya_Narayanan, would the Remove Duplicate operation of the Item Lists node be what you’re looking for? This allows removing duplicates. If you need to cross-reference data to identify duplicates, there’s also the Merge node offering a Remove Key Matches operation.

If these aren’t what you’re looking for, could you share an example of the data you are working with?

Hi,

Thanks for the response, what i am trying to achive from the data that i have is some thing like this.

Domain Count
a 10
b 15
c 5

It like similar to pivot fucntion which is avaiable on excel

I see, you might find this example helpful then: Get values with no duplicates - #7 by MutedJam

Hi,

Sorry for the late response, I am very new to java script so your example really helped me a lot in getting the count of domain.

Now with that said, i am also trying to run a API query to a 3rd party URL to find if the domain is disposable or not.

I tired to use the HTTP node to achive it and i get the result, but the problem is the API on respond TRUE/FLASE and it doesnt say about the domain name. Is there a way to achive what i am looking for?

I am using the follwing 3rd party API to validate the domain
Getting Started with Kickbox

Example:

Domain. disposable
gmail. no
yahoo. no
check. yes

I know the above is possible using function node, but again, as mentioned i am new to java and the syntax i tried using google doesnt work on the node.

Hey @Sathya_Narayanan,

You have a couple of options you can use the HTTP Request node to call the api you want to use which looks like it would work well or you could use the One Simple API node which has an email check option that should do what you are after.

Hi,

I dont find that node on my N8N installation, do i have to add this node? if yes, can you please let me know as to how to do it and more over, i need to validate the domain name alone and not the email address. Does this node support that as well?

Sorry if my questions are lame, new to this and curious to know.

Hey,

It was released in version 149 so you may need to update unless you are using the desktop version.

It works on the entire email address like Kickbox does but the result will tell you if the domain is known to be a disposable address.

Thanks checked the documetation and found that i can upgrde the n8n version using npm update -g n8n

One quick question, will this upgrade destory my exisitng workflows?, do i have to run any back up before upgrade ?

Please let me know.

Hi,

I have upgrded it and it seem to be fine, however, the simple one api seems to be a paid services. Even the free one gives me less number of domain api checker.

50 request per hour is less

You should be all good, to be safe you could export all the workflows using the cli tool CLI commands for n8n | Docs

Hey jon,

Even the one simple api is not helping me because the result i got when it try to validate a domain gives me a response like this.

‘’’ [

{

“is_format_valid”: true,

“is_domain_valid”: false,

“domain_has_valid_mx_records”: true,

“is_email_free”: false,

“is_email_disposable”: false,

“is_email_role”: false,

“canonical”: “”,

“deliverability”: “BAD”,

“safe_to_register_as_user”: false,

“elapsed”: 0.12239813804626465

}’’’

In the above response i dont know to which domain it has this response, meaning with out the domain name i will not be prepare a report.

But what i am looking for is very simple table like this.

Domain Disposiable
gmail.com no
yahoo.com no
checker.com yes

something similar to this.

Hey @Sathya_Narayanan,

I have popped together a quick worklfow to show how to use OneSimpleAPI and Kickbox through the HTTP Request Node.

The function node just returns 4 emails address that both services will use, Because OneSimpleAPI doesn’t return the domain (Just put in a feature request with the chap that makes it) we use the Merge node to join it up then the set node at the end to just return the Domain and Disposable result.

On the bottom part we use the same email addresses then use the HTTP Request node to call Kickbox then we use the set node to return the 2 columns.

Example Workflow
{
  "nodes": [
    {
      "parameters": {},
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "typeVersion": 1,
      "position": [
        250,
        300
      ]
    },
    {
      "parameters": {
        "functionCode": "const newItems = [];\nconst emails = ['[email protected]', '[email protected]', '[email protected]', '[email protected]'];\n\nfor (let i=0;i<4;i++) {\n  newItems.push({\n    json: {\n      mail: emails[i]\n    }\n  });\n}\n\nreturn newItems;\n"
      },
      "name": "Function",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        400,
        300
      ]
    },
    {
      "parameters": {
        "resource": "utility",
        "emailAddress": "={{$json[\"mail\"]}}"
      },
      "name": "One Simple API",
      "type": "n8n-nodes-base.oneSimpleApi",
      "typeVersion": 1,
      "position": [
        560,
        300
      ],
      "credentials": {
        "oneSimpleApi": {
          "id": "33",
          "name": "One Simple account"
        }
      }
    },
    {
      "parameters": {
        "mode": "mergeByIndex"
      },
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "typeVersion": 1,
      "position": [
        750,
        280
      ]
    },
    {
      "parameters": {},
      "name": "purely cosmetic",
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [
        560,
        140
      ]
    },
    {
      "parameters": {
        "keepOnlySet": true,
        "values": {
          "string": [
            {
              "name": "domain",
              "value": "={{$json[\"mail\"].split('@')[1]}}"
            }
          ],
          "boolean": [
            {
              "name": " Disposable",
              "value": "={{$json[\"is_email_disposable\"]}}"
            }
          ]
        },
        "options": {}
      },
      "name": "Set",
      "type": "n8n-nodes-base.set",
      "typeVersion": 1,
      "position": [
        910,
        280
      ]
    },
    {
      "parameters": {
        "url": "=https://api.kickbox.com/v2/verify",
        "options": {},
        "queryParametersUi": {
          "parameter": [
            {
              "name": "apikey",
              "value": "PUT_YOUR_API_KEY_HERE"
            },
            {
              "name": "email",
              "value": "={{$json[\"mail\"]}}"
            }
          ]
        }
      },
      "name": "KickBox",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        560,
        540
      ]
    },
    {
      "parameters": {
        "keepOnlySet": true,
        "values": {
          "string": [
            {
              "name": "domain",
              "value": "={{$json[\"domain\"]}}"
            }
          ],
          "boolean": [
            {
              "name": "disposable",
              "value": "={{$json[\"disposable\"]}}"
            }
          ]
        },
        "options": {}
      },
      "name": "Set1",
      "type": "n8n-nodes-base.set",
      "typeVersion": 1,
      "position": [
        760,
        540
      ]
    }
  ],
  "connections": {
    "Start": {
      "main": [
        [
          {
            "node": "Function",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Function": {
      "main": [
        [
          {
            "node": "One Simple API",
            "type": "main",
            "index": 0
          },
          {
            "node": "purely cosmetic",
            "type": "main",
            "index": 0
          },
          {
            "node": "KickBox",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "One Simple API": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Merge": {
      "main": [
        [
          {
            "node": "Set",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "purely cosmetic": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "KickBox": {
      "main": [
        [
          {
            "node": "Set1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Hopefully this helps :+1:

Quick update…

The change to OneSimpleAPI has happened so now the response has everything needed, New workflow is below that shows both options.

The API change doesn’t require any changes to n8n it was a backend change and I would like to thank Pablius for being so quick :smiley:

Example Workflow
{
  "nodes": [
    {
      "parameters": {},
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "typeVersion": 1,
      "position": [
        250,
        300
      ]
    },
    {
      "parameters": {
        "functionCode": "const newItems = [];\nconst emails = ['[email protected]', '[email protected]', '[email protected]', '[email protected]'];\n\nfor (let i=0;i<4;i++) {\n  newItems.push({\n    json: {\n      mail: emails[i]\n    }\n  });\n}\n\nreturn newItems;\n"
      },
      "name": "Function",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        400,
        300
      ]
    },
    {
      "parameters": {
        "resource": "utility",
        "emailAddress": "={{$json[\"mail\"]}}"
      },
      "name": "One Simple API",
      "type": "n8n-nodes-base.oneSimpleApi",
      "typeVersion": 1,
      "position": [
        550,
        300
      ],
      "credentials": {
        "oneSimpleApi": {
          "id": "33",
          "name": "One Simple account"
        }
      }
    },
    {
      "parameters": {
        "keepOnlySet": true,
        "values": {
          "string": [
            {
              "name": "domain",
              "value": "={{$json[\"domain\"]}}"
            }
          ],
          "boolean": [
            {
              "name": "disposable",
              "value": "={{$json[\"is_email_disposable\"]}}"
            }
          ]
        },
        "options": {}
      },
      "name": "Set",
      "type": "n8n-nodes-base.set",
      "typeVersion": 1,
      "position": [
        700,
        300
      ]
    },
    {
      "parameters": {
        "url": "=https://api.kickbox.com/v2/verify",
        "options": {},
        "queryParametersUi": {
          "parameter": [
            {
              "name": "apikey",
              "value": "PUT_YOUR_API_KEY_HERE"
            },
            {
              "name": "email",
              "value": "={{$json[\"mail\"]}}"
            }
          ]
        }
      },
      "name": "KickBox",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        550,
        500
      ]
    },
    {
      "parameters": {
        "keepOnlySet": true,
        "values": {
          "string": [
            {
              "name": "domain",
              "value": "={{$json[\"domain\"]}}"
            }
          ],
          "boolean": [
            {
              "name": "disposable",
              "value": "={{$json[\"disposable\"]}}"
            }
          ]
        },
        "options": {}
      },
      "name": "Set1",
      "type": "n8n-nodes-base.set",
      "typeVersion": 1,
      "position": [
        700,
        500
      ]
    }
  ],
  "connections": {
    "Start": {
      "main": [
        [
          {
            "node": "Function",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Function": {
      "main": [
        [
          {
            "node": "One Simple API",
            "type": "main",
            "index": 0
          },
          {
            "node": "KickBox",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "One Simple API": {
      "main": [
        [
          {
            "node": "Set",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "KickBox": {
      "main": [
        [
          {
            "node": "Set1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
1 Like

Hey Jon,

Thank you, i got things working… you guys are gr8…

3 Likes