Splitting JSON Payload and send message per event

Hi,

I set up a workflow to receive a JSON payload (containing notifications) from a service I am running. The payload contains all notifications with a specific status. I want to split these messages and send a message to Telegram for each of them. Afterwards I want to change the status to notification read. How can I split the messages for each event in the payload?

[
  {
    "notifications": [
      {
        "id": "43",
        "eventId": "8cac3d59-a4fa-4de6-a575-fed1490f23ba",
        "title": "n8n at XXX.XXX.TLD updated to package version 2.4.4",
        "message": "The application installed at https://XXX.XXX.TLD was updated.\n\nChangelog:\n* Update n8n to 0.179.0\n\n",
        "creationTime": "2022-05-31T01:01:05.000Z",
        "acknowledged": true
      },
      {
        "id": "42",
        "eventId": "XXX",
        "title": "Cloudron updated to v7.2.2",
        "message": "Cloudron was updated from v7.1.4 to v7.2.2.\n\nChangelog:\n* Update cloudron-manifestformat for new scheduler patterns\n* collectd: FQDNLookup causes collectd install to fail\n\n",
        "creationTime": "2022-05-30T23:07:20.000Z",
        "acknowledged": true
      },
      {
        "id": "41",
        "eventId": null,
        "title": "Cloudron v7.2.2 is available",
        "message": "Changelog:\n* mail: hide log button for non-superadmins\n* firewall: do not add duplicate ldap redirect rules\n* ldap: respond to RootDSE\n* Check if CNAME record exists and remove it if overwrite is set\n* cifs: use credentials file for better password support\n* installer: rework script to fix DNS resolution issues\n* backup cleaner: do not clean if not mounted\n* restore: fix sftp private key perms\n* support: add a separate system user named cloudron-support\n* sshfs: fix bug where sshfs mounts were generated without unbound dependancy\n* cloudron-setup: add --setup-token\n* notifications: add installation event\n* backups: set label of backup and control it's retention\n* wasabi: add new regions (London, Frankfurt, Paris, Toronto)\n* docker: update to 20.10.14\n* Ensure LDAP usernames are always treated lowercase\n* Add a way to make LDAP users local\n* proxyAuth: set X-Remote-User (rfc3875)\n* GoDaddy: there is now a delete API\n* nginx: use ubuntu packages for ubuntu 20.04 and 22.04\n\n\nGo to the settings view to update.\n\n",
        "creationTime": "2022-05-30T17:43:46.000Z",
        "acknowledged": true
      }
    ]
  }
]

Hi @Candy9811

You can use the item node for this.
This will split the notifications into items.

Thanks for your fast answer @BramKn . May I ask you how to that exactly? I read the doc but weren’t able to find out.

Hi @Candy9811

I am sorry, not able to get behind a pc now to give an example.
The item lists node allows you to split the array. This is done with the split out items operation.
Hope this helps.

Thank you, that was the hint I needed:

Works well now.

1 Like