Building a digest of RSS Feed (mailgun error)

Like the title says, the goal is to send a digest of entries from an rss feed every friday, or at every 10 items for example.

So far, this is what I have.

{
  "nodes": [
    {
      "parameters": {
        "url": "https://brunoamaral.eu/index.xml"
      },
      "name": "RSS Feed Read",
      "type": "n8n-nodes-base.rssFeedRead",
      "typeVersion": 1,
      "position": [
        450,
        170
      ]
    },
    {
      "parameters": {
        "interval": 24,
        "unit": "hours"
      },
      "name": "Interval",
      "type": "n8n-nodes-base.interval",
      "typeVersion": 1,
      "position": [
        250,
        160
      ]
    },
    {
      "parameters": {
        "fromEmail": "[email protected]",
        "toEmail": "[email protected]",
        "subject": "Digest",
        "text": "=<h2>{{$node[\"SplitInBatches\"].data[\"title\"]}}</h2>\n<a>{{$node[\"SplitInBatches\"].data[\"link\"]}}</a>\n{{$node[\"SplitInBatches\"].data[\"contentSnippet\"]}}"
      },
      "name": "Mailgun",
      "type": "n8n-nodes-base.mailgun",
      "typeVersion": 1,
      "position": [
        1230,
        190
      ],
      "credentials": {
        "mailgunApi": "Mailgun"
      }
    },
    {
      "parameters": {},
      "name": "SplitInBatches",
      "type": "n8n-nodes-base.splitInBatches",
      "typeVersion": 1,
      "position": [
        710,
        200
      ]
    }
  ],
  "connections": {
    "RSS Feed Read": {
      "main": [
        [
          {
            "node": "SplitInBatches",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Interval": {
      "main": [
        [
          {
            "node": "RSS Feed Read",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SplitInBatches": {
      "main": [
        [
          {
            "node": "Mailgun",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

But when I reach the mailgun node, it returns StatusCodeError: 404 - {"message":"Domain not found: mg.brunoamaral.net"}

Is this coming from n8n or mailgun? Because in huginn I had the same credentials and it is working.

I think i figured out part of the problem. In the CLI, mailgun returns domain not found if I use https://api.mailgun.net/v3/mg.brunoamaral.net/messages

But if works with api.eu.mailgun.net. Is that previous API domain hardcoded?

Which API-URL to use depends on what you selected when you did set up your Mailgun-Domain.

No, that URL is not hardcoded. You can select which one to use in the Mailgun-Credentials. There is the option “API Domain:”

1 Like

Thanks, this was clearly me not paying enough attention when setting up the credentials.

on a side question, any suggestion on how to bundle the digest into a single email ?

Sure, you can do it like that:

{
  "nodes": [
    {
      "parameters": {
        "url": "https://brunoamaral.eu/index.xml"
      },
      "name": "RSS Feed Read",
      "type": "n8n-nodes-base.rssFeedRead",
      "typeVersion": 1,
      "position": [
        500,
        550
      ]
    },
    {
      "parameters": {
        "fromEmail": "[email protected]",
        "toEmail": "[email protected]",
        "subject": "Digest",
        "text": "={{$node[\"Function\"].data[\"emailText\"]}}"
      },
      "name": "Mailgun",
      "type": "n8n-nodes-base.mailgun",
      "typeVersion": 1,
      "position": [
        900,
        550
      ],
      "credentials": {
        "mailgunApi": ""
      },
      "disabled": true
    },
    {
      "parameters": {
        "functionCode": "items[0].json.myVariable = 1;\n\nlet emailText = '';\nfor (const item of items) {\n  emailText += `${item.json.title} - ${item.json.isoDate}\\n${item.json.link}\\n\\n`;\n}\n\nreturn [\n  {\n    json: {\n      emailText\n    }\n  }\n];"
      },
      "name": "Function",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        700,
        550
      ]
    },
    {
      "parameters": {
        "triggerTimes": {
          "item": [
            {
              "hour": 8
            }
          ]
        }
      },
      "name": "Cron",
      "type": "n8n-nodes-base.cron",
      "typeVersion": 1,
      "position": [
        300,
        550
      ]
    }
  ],
  "connections": {
    "RSS Feed Read": {
      "main": [
        [
          {
            "node": "Function",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Function": {
      "main": [
        [
          {
            "node": "Mailgun",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Cron": {
      "main": [
        [
          {
            "node": "RSS Feed Read",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

The “Split in Batches”-Node is meant if you have a lot of items and you want to iterate only on a smaller amount of them at once. Like for example in this example:
https://n8n.io/workflows/5
There it is possible that thousands of URLs get read from the Spreadsheet but sending thousands of URLs to one API would simply produce thousands of errors. So with the help of that node, they can be split in smaller batches and the data so processed step by step.