How to use the "RSS > Split by batches" example to output somewhere else?

Hello,

  1. I’m attempting to recreate something I’ve managed to do with both Zapier & IFTTT in n8n.
    This being read one or more RSS feeds and post to a(Google Chat) channel.
    The example https://docs.n8n.io/nodes/n8n-nodes-base.splitInBatches/#example-usage seems to be only half of the solution as it doesn’t show where to send the data that you have split…
    Can anyone point me at how to make that happen?
  2. I’ve worked out the json for sending to the Google Chat webhook to that below, but the http request node is a bit cryptic on how to send the nested arrays.So how do I make that happen?..

Thanks,
Sean
---- The variables are those listed in the IFTTT RSS parser (although that’s a bit hit and miss), and this does work if I send it from a shell using curl

        "cards": [{
                "header": {
                        "title": "EntryTitle",
                        "subtitle": "EntryAuthor - EntryPublished",
                        "imageUrl": "EntryImageUrl"
                },
                "sections": [{
                                "widgets": [{
                                                "textParagraph": {
                                                        "text": "EntryContent"
                                                }
                                        }
                                ]
                        },
                        {
                                "widgets": [{
                                        "buttons": [{
                                                "textButton": {
                                                        "text": "OPEN",
                                                        "onClick": {
                                                                "openLink": {
                                                                        "url": "EventUrl"
                                                                }
                                                        }
                                                }
                                        }]
                                }]
                        }
                ]
        }]
}```
# ----

Hey @Gadg3ts! :wave:

Welcome to the community!

I have modified the Example Workflow and added the HTTP Request node to the workflow.

If you run this workflow you will notice that we are getting output for each article.

{
  "name": "",
  "nodes": [
    {
      "parameters": {},
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "typeVersion": 1,
      "position": [
        150,
        400
      ]
    },
    {
      "parameters": {
        "functionCode": "return [\n  {\n    json: {\n      url: 'https://medium.com/feed/n8n-io',\n    }\n  },\n  {\n    json: {\n      url: 'https://dev.to/feed/n8n',\n    }\n  }\n];"
      },
      "name": "Function",
      "type": "n8n-nodes-base.function",
      "position": [
        350,
        400
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "url": "={{$node[\"SplitInBatches\"].json[\"url\"]}}"
      },
      "name": "RSS Feed Read",
      "type": "n8n-nodes-base.rssFeedRead",
      "position": [
        750,
        300
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "batchSize": 1,
        "options": {}
      },
      "name": "SplitInBatches",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        540,
        400
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "requestMethod": "POST",
        "url": "https://httpbin.org/post",
        "options": {},
        "bodyParametersUi": {
          "parameter": [
            {
              "name": "title",
              "value": "={{$node[\"RSS Feed Read\"].json[\"title\"]}}"
            }
          ]
        }
      },
      "name": "HTTP Request",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        940,
        210
      ]
    }
  ],
  "connections": {
    "Function": {
      "main": [
        [
          {
            "node": "SplitInBatches",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "RSS Feed Read": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SplitInBatches": {
      "main": [
        [
          {
            "node": "RSS Feed Read",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Start": {
      "main": [
        [
          {
            "node": "Function",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "node": "SplitInBatches",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {}
}

Hope this helps. :slightly_smiling_face:

Yes it is helpful thanks :slight_smile:
So this gives me a set of fields from the RSS:
title
link
pubDate
content
contentSnippet
id
isoDate
author

but how do I feed that into the json I posted earlier?
(as in the value for EntryContent/EntryTitle/etc)
I’ve signed up with pipedream.com to determine what is actually being sent.

Thanks,
Sean

Actually, I appear to have figured out how to set the parameters.
So I’m seeing the correct json at the pipedream end.
Next to look up how to not flood gchat with the same messages! (I’ve seen it somewhere)
Actually, there are 2 things:

  1. how do I rate limit the http requests to the destination? (so that google doesn’t block me)
  2. how do I not send the same RSS articles more than once? (adding a mongodb/database node or something??)

So this seems to work and has the card formatting as I’m expecting it.
Obviously, replace the destination webhook with the one you get from the gchat interface.
The httprequest might be trying to send 2 lots of data though, so I’m not sure if this is 100%working.But then I’ve only been trying it out for 3 days.

{
  "name": "rss to http-request / gchat",
  "nodes": [
    {
      "parameters": {},
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "typeVersion": 1,
      "position": [
        250,
        300
      ]
    },
    {
      "parameters": {
        "functionCode": "return [\n  {\n    json: {\n      url: 'https://gadg3ts.com/feed/wprss/index.xml',\n    }\n  },\n  {\n    json: {\n      url: 'https://gongbong.media/feed/wprss/index.xml',\n    }\n  }\n];"
      },
      "name": "Function",
      "type": "n8n-nodes-base.function",
      "position": [
        580,
        360
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "url": "={{$node[\"SplitInBatches\"].json[\"url\"]}}"
      },
      "name": "RSS Feed Read",
      "type": "n8n-nodes-base.rssFeedRead",
      "position": [
        1000,
        410
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "batchSize": 1,
        "options": {
          "reset": false
        }
      },
      "name": "SplitInBatches",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        790,
        410
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "requestMethod": "POST",
        "url": "https://chat.googleapis.com/v1/spaces/replacethjis/messages?key=withYourGoogleChatWebhookString",
        "jsonParameters": true,
        "options": {
          "bodyContentType": "raw",
          "fullResponse": true,
          "timeout": 100000
        },
        "bodyParametersJson": "={\n        \"cards\": [{\n                \"header\": {\n                        \"title\": \"{{$node[\"RSS Feed Read\"].json[\"title\"]}}\",\n                        \"subtitle\": \"Published {{$node[\"RSS Feed Read\"].json[\"pubDate\"]}}\",\n                        \"imageUrl\": \"{{$node[\"Function3\"].json[\"EntryImage\"]}}\"\n                },\n                \"sections\": [{\n                                \"widgets\": [{\n                                                \"textParagraph\": {\n                                                        \"text\": \"{{$node[\"RSS Feed Read\"].json[\"contentSnippet\"]}}\"\n                                                }\n                                        }\n                                ]\n                        },\n                        {\n                                \"widgets\": [{\n                                        \"buttons\": [{\n                                                \"textButton\": {\n                                                        \"text\": \"OPEN\",\n                                                        \"onClick\": {\n                                                                \"openLink\": {\n                                                                        \"url\": \"{{$node[\"RSS Feed Read\"].json[\"link\"]}}\"\n                                                                }\n                                                        }\n                                                }\n                                        }]\n                                }]\n                        }\n                ]\n        }]\n}"
      },
      "name": "HTTP Request",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        1530,
        140
      ],
      "alwaysOutputData": true
    },
    {
      "parameters": {
        "triggerTimes": {
          "item": [
            {
              "mode": "everyHour"
            },
            {}
          ]
        }
      },
      "name": "Cron",
      "type": "n8n-nodes-base.cron",
      "typeVersion": 1,
      "position": [
        290,
        460
      ]
    },
    {
      "parameters": {
        "functionCode": "const text = items[0].json.content.split('\"')[1]\nreturn [\n  {\n    json: { EntryImage: text } \n  }\n]\n\n"
      },
      "name": "Function3",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        1320,
        530
      ]
    }
  ],
  "connections": {
    "Function": {
      "main": [
        [
          {
            "node": "SplitInBatches",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "RSS Feed Read": {
      "main": [
        [
          {
            "node": "Function3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SplitInBatches": {
      "main": [
        [
          {
            "node": "RSS Feed Read",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "node": "SplitInBatches",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Start": {
      "main": [
        []
      ]
    },
    "Cron": {
      "main": [
        [
          {
            "node": "Function",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Function3": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "timezone": "Europe/London",
    "executionTimeout": -1
  },
  "id": "2"
}

so the issue I’m having is that one of the feeds has more html in the contentSnippet parameter, with extra double-quotes which confuse the parser.
but it works great for the first feed :slight_smile: