Switch node distribute data

I’d like to ask for some assistance because I can’t think of a way to do it myself. I make a call to API that returns me a JSON string that looks something like this

[
  {
    "id": 1,
    "name": "Some Guy 1",
    "task": "Some Task 1",
    "email": "[email protected]",
  },
  {
    "id": 2,
    "name": "Some Guy 1",
    "task": "Some Task 2",
    "email": "[email protected]",
  },
  {
    "id": 3,
    "name": "Some Guy 2",
    "task": "Some Task 3",
    "email": "[email protected]",
  },
  {
    "id": 4,
    "name": "Some Guy 3",
    "task": "Some Task 4",
    "email": "[email protected]",
  }
]

The goal is to group this data by name convert it to HTML table and send that table to each person. In this exact example there would be three emails sent.

If I were to write every possible user/email in Switch node I know how to do it. The problem is this user/email list can change over time and I don’t want to come back to edit Workflow each time new user is added to the system. Is there a way to configure Switch node so that it would distribute data dynamically? If there is can someone please show me an example.

Information on your n8n setup

  • n8n version: 1.20.0

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Hey @Tom_M,

Just to check are you trying to send name 1 only the 2 values for them and name 2 the value for them and name 3 the one for them?

Yes.

Basically there can be X amount if users. I want to send each user one email that contains tasks assigned to that person. So in my example above there would be 3 emails send. Person 1 would receive table with two rows. Person 2 would receive table with one row. And person 3 would receive table with also one row.