This workflow corresponds to n8n.io template #7566 — we link there as the canonical source.
This workflow follows the Agent → Discord recipe pattern — see all workflows that pair these two integrations.
The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"id": "gJVUOpQW1iQO8hDK",
"meta": {
"templateCredsSetupCompleted": true
},
"name": "YNAB Auto Budget",
"tags": [],
"nodes": [
{
"id": "219be639-7a8b-4cf3-8b8d-54cfa084fedb",
"name": "When clicking \u2018Execute workflow\u2019",
"type": "n8n-nodes-base.manualTrigger",
"position": [
-80,
608
],
"parameters": {},
"typeVersion": 1
},
{
"id": "e320e200-279d-4d7b-8f9a-dbc90ce127ff",
"name": "Variables",
"type": "n8n-nodes-base.set",
"position": [
144,
608
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "5a1da0c7-e664-4662-b3b6-3a19cf54da36",
"name": "budget_id",
"type": "string",
"value": "CHANGEME"
},
{
"id": "7f849d4b-72ba-4d4a-82e0-485e5fdde1ba",
"name": "account_id",
"type": "string",
"value": "CHANGEME"
},
{
"id": "ae5133fe-f370-4d13-8be7-8c9cfe607574",
"name": "api_key",
"type": "string",
"value": "CHANGEME"
},
{
"id": "b5476fcc-763e-4a8d-97ca-2447cc8984d1",
"name": "previous_days",
"type": "string",
"value": "30"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "fded027b-70ed-44e4-88fc-2b9ae9a73d21",
"name": "Get Categories",
"type": "n8n-nodes-base.httpRequest",
"position": [
368,
488
],
"parameters": {
"url": "=https://api.ynab.com/v1/budgets/{{ $json.budget_id }}/categories",
"options": {},
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "accept",
"value": "application/json"
},
{
"name": "Authorization",
"value": "=Bearer {{ $json.api_key }}"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "71e6736f-f3ff-438a-86d1-9cf9120e4ed4",
"name": "Get Category Groups",
"type": "n8n-nodes-base.splitOut",
"position": [
592,
488
],
"parameters": {
"options": {},
"fieldToSplitOut": "data.category_groups"
},
"typeVersion": 1
},
{
"id": "1c082196-26a7-40fe-995c-43b2c17c45fa",
"name": "Remove Invalid Category Groups",
"type": "n8n-nodes-base.filter",
"position": [
816,
488
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "9dcb56d5-a68f-4fa1-9957-414c4b31673a",
"operator": {
"type": "boolean",
"operation": "false",
"singleValue": true
},
"leftValue": "={{ $json.hidden }}",
"rightValue": "true"
},
{
"id": "0fdf4d82-5ab2-4e93-85dc-9941fb13f3b2",
"operator": {
"type": "boolean",
"operation": "false",
"singleValue": true
},
"leftValue": "={{ $json.deleted }}",
"rightValue": ""
}
]
}
},
"typeVersion": 2.2
},
{
"id": "5d3bce98-2d5f-4bd4-8d1e-7f6686e1e73b",
"name": "Hide Internal Categories",
"type": "n8n-nodes-base.filter",
"position": [
1264,
488
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "5ac0ef28-11d5-4a89-9a03-a807540a9c19",
"operator": {
"type": "boolean",
"operation": "false",
"singleValue": true
},
"leftValue": "={{ $json.hidden }}",
"rightValue": ""
},
{
"id": "96a8c890-a08b-4841-a14e-aa7d8f9a6d9e",
"operator": {
"type": "boolean",
"operation": "false",
"singleValue": true
},
"leftValue": "={{ $json.deleted }}",
"rightValue": ""
},
{
"id": "4984c1bb-a80b-4c30-8818-d614f2c3bf55",
"operator": {
"type": "string",
"operation": "notEquals"
},
"leftValue": "={{ $json.category_group_name }}",
"rightValue": "=\"Internal Master Category\""
}
]
}
},
"typeVersion": 2.2
},
{
"id": "19132f05-a6d1-4e16-a8b9-eaaf93ad25f9",
"name": "Flatten Category Groups to Categories",
"type": "n8n-nodes-base.splitOut",
"position": [
1040,
488
],
"parameters": {
"options": {},
"fieldToSplitOut": "=categories"
},
"typeVersion": 1
},
{
"id": "dc74b4ed-a5e7-4a9e-b721-8f501261d716",
"name": "Categories Only",
"type": "n8n-nodes-base.set",
"position": [
1488,
488
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "4a6fb057-55ab-4b67-bad6-77c505bea0f7",
"name": "id",
"type": "string",
"value": "={{ $json.id }}"
},
{
"id": "f132fcc8-a3cd-4f78-b9f0-c0f6965f1e97",
"name": "name",
"type": "string",
"value": "={{ $json.name }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "b98fa812-d775-46c2-ab4c-631de78b8069",
"name": "Get Transactions",
"type": "n8n-nodes-base.httpRequest",
"position": [
1040,
680
],
"parameters": {
"url": "=https://api.ynab.com/v1/budgets/{{ $json.budget_id }}/accounts/{{ $json.account_id }}/transactions",
"options": {},
"sendQuery": true,
"sendHeaders": true,
"queryParameters": {
"parameters": [
{
"name": "since_date",
"value": "={{ $today.minus({ days: $json.previous_days }).format('yyyy-MM-dd') }}"
},
{
"name": "type",
"value": "uncategorized"
}
]
},
"headerParameters": {
"parameters": [
{
"name": "accept",
"value": "application/json"
},
{
"name": "Authorization",
"value": "=Bearer {{ $json.api_key }}"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "427d33a0-f867-49ec-9ed9-57a64e9f1969",
"name": "Break out Transactions",
"type": "n8n-nodes-base.splitOut",
"position": [
1264,
680
],
"parameters": {
"options": {},
"fieldToSplitOut": "data.transactions"
},
"typeVersion": 1
},
{
"id": "20d062e0-3197-4935-8566-bfae13e5caf6",
"name": "Filter out transfers and invalid transactions",
"type": "n8n-nodes-base.filter",
"position": [
1488,
680
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "loose"
},
"combinator": "and",
"conditions": [
{
"id": "abf0b4b4-ac98-4a9c-bd5d-2d09a7bd7942",
"operator": {
"type": "boolean",
"operation": "notExists",
"singleValue": true
},
"leftValue": "={{ $json.category_id }}",
"rightValue": ""
},
{
"id": "f1549604-56eb-48eb-892e-7896c65c206d",
"operator": {
"type": "boolean",
"operation": "false",
"singleValue": true
},
"leftValue": "={{ $json.deleted }}",
"rightValue": ""
},
{
"id": "abd3c4bf-7f6c-41a9-8142-47ccf3086244",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.category_name }}",
"rightValue": "Uncategorized"
},
{
"id": "8e2bf6e6-3f70-4d19-9c4b-efa5ab246a70",
"operator": {
"type": "boolean",
"operation": "empty",
"singleValue": true
},
"leftValue": "={{ $json.transfer_account_id?.toBoolean() }}",
"rightValue": ""
},
{
"id": "f51eff3f-68ea-4695-816d-f1a346385be0",
"operator": {
"type": "boolean",
"operation": "empty",
"singleValue": true
},
"leftValue": "={{ $json.transfer_transaction_id?.toBoolean() }}",
"rightValue": ""
}
]
},
"looseTypeValidation": true
},
"typeVersion": 2.2
},
{
"id": "6c763ed4-e51e-4d29-93f5-4610478d0c30",
"name": "Merge",
"type": "n8n-nodes-base.merge",
"position": [
1936,
608
],
"parameters": {},
"typeVersion": 3.2
},
{
"id": "934c3ccd-94d6-4567-8a30-044d7e9dcd5c",
"name": "Group Categories",
"type": "n8n-nodes-base.aggregate",
"position": [
1712,
488
],
"parameters": {
"options": {},
"aggregate": "aggregateAllItemData",
"destinationFieldName": "categories"
},
"typeVersion": 1
},
{
"id": "63ef450d-8c10-452f-aaf7-39dddeb52436",
"name": "Group Transactions",
"type": "n8n-nodes-base.aggregate",
"position": [
1712,
680
],
"parameters": {
"options": {},
"aggregate": "aggregateAllItemData",
"destinationFieldName": "transactions"
},
"typeVersion": 1
},
{
"id": "13ad851d-e43f-46e8-a90b-b2e9eed9931d",
"name": "AI Agent1",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
2608,
608
],
"parameters": {
"text": "=Given the following list of budget categories\n\n{{ JSON.stringify($('Categories Only').all(),null,2) }}\n\nAnalyze this json and come up with the most likely best fit for budget category, if you do not know or there is no good match then ignore it. \n\nIf you come up with a good match then change the output fields\noutput.category_id = budget.id\noutput.category_name = budget.name\noutput.flag_color = 'yellow'\noutput.flag_name = 'n8n'\n\nLeave all other fields alone and return them exactly as they were provided for the input. \n\nHere is the input data: \n{{ JSON.stringify($json,null,2) }}\n\n\n\n",
"options": {
"systemMessage": "You are a helpful assistant who is tasked with categorizing budget items. "
},
"promptType": "define",
"hasOutputParser": true
},
"typeVersion": 2.2
},
{
"id": "a7e6d5de-86f6-4341-a033-86fcdeada5e0",
"name": "OpenAI Chat Model2",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
2616,
832
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-5-mini",
"cachedResultName": "gpt-5-mini"
},
"options": {}
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.2
},
{
"id": "5c7d87fe-7ee3-4a8b-bb1c-90cd39966f99",
"name": "Structured Output Parser1",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
2744,
832
],
"parameters": {
"schemaType": "manual",
"inputSchema": "{\n \"id\": { \"type\": \"string\" },\n \"date\": { \"type\": \"string\" },\n \"amount\": { \"type\": \"number\" },\n \"memo\": { \"type\": [\"string\", \"null\"] },\n \"cleared\": { \"type\": \"string\" },\n \"approved\": { \"type\": \"boolean\" },\n \"flag_color\": { \"type\": [\"string\", \"null\"] },\n \"flag_name\": { \"type\": [\"string\", \"null\"] },\n \"account_id\": { \"type\": \"string\" },\n \"account_name\": { \"type\": \"string\" },\n \"payee_id\": { \"type\": [\"string\", \"null\"] },\n \"payee_name\": { \"type\": [\"string\", \"null\"] },\n \"category_id\": { \"type\": [\"string\", \"null\"] },\n \"category_name\": { \"type\": [\"string\", \"null\"] },\n \"transfer_account_id\": { \"type\": [\"string\", \"null\"] },\n \"transfer_transaction_id\": { \"type\": [\"string\", \"null\"] },\n \"matched_transaction_id\": { \"type\": [\"string\", \"null\"] },\n \"import_id\": { \"type\": [\"string\", \"null\"] },\n \"import_payee_name\": { \"type\": [\"string\", \"null\"] },\n \"import_payee_name_original\": { \"type\": [\"string\", \"null\"] },\n \"debt_transaction_type\": { \"type\": [\"string\", \"null\"] },\n \"deleted\": { \"type\": \"boolean\" },\n \"subtransactions\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"id\": { \"type\": \"string\" },\n \"transaction_id\": { \"type\": [\"string\", \"null\"] },\n \"amount\": { \"type\": \"number\" },\n \"memo\": { \"type\": [\"string\", \"null\"] },\n \"payee_id\": { \"type\": [\"string\", \"null\"] },\n \"payee_name\": { \"type\": [\"string\", \"null\"] },\n \"category_id\": { \"type\": [\"string\", \"null\"] },\n \"category_name\": { \"type\": [\"string\", \"null\"] },\n \"transfer_account_id\": { \"type\": [\"string\", \"null\"] },\n \"transfer_transaction_id\": { \"type\": [\"string\", \"null\"] },\n \"deleted\": { \"type\": [\"boolean\", \"null\"] }\n },\n \"required\": [\"id\", \"amount\"]\n },\n \"minItems\": 0\n }\n}"
},
"typeVersion": 1.3
},
{
"id": "fa5c461b-40a1-413a-82cd-8be3098d18ea",
"name": "Loop Transactions",
"type": "n8n-nodes-base.splitOut",
"position": [
2384,
608
],
"parameters": {
"options": {},
"fieldToSplitOut": "transactions"
},
"typeVersion": 1
},
{
"id": "ccee6170-02b5-4e88-93c1-acbbf2b8bb91",
"name": "Skip Categories, Loop Transactions",
"type": "n8n-nodes-base.if",
"position": [
2160,
608
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "02774f04-b665-4fe5-9e64-ba067c8bc5f9",
"operator": {
"type": "array",
"operation": "exists",
"singleValue": true
},
"leftValue": "={{ $json.transactions }}",
"rightValue": ""
}
]
}
},
"typeVersion": 2.2
},
{
"id": "f8798e8d-0219-437a-8397-c5328f892127",
"name": "Discord",
"type": "n8n-nodes-base.discord",
"position": [
3408,
416
],
"parameters": {
"content": "=Auto budgeted {{ $json.transactions[0].length }} transactions.\n\n{{ $json.transactions[0].map(transaction => '- ' + transaction.payee_name + ' | ' + transaction.category_name + ' | $' + (transaction.amount / 1000)).join('\\n') }}\n\nhttps://app.ynab.com/{{$('Variables').item.json.budget_id}}/accounts/{{ $('Variables').item.json.account_id }}",
"options": {
"username": "YNAB Budget Bot",
"avatar_url": "https://images.icon-icons.com/401/PNG/512/YNAB_40408.png"
},
"authentication": "webhook"
},
"credentials": {
"discordWebhookApi": {
"name": "<your credential>"
}
},
"typeVersion": 2
},
{
"id": "2230670b-f75d-44f7-80d1-25c88efa4472",
"name": "YNAB modify transactions",
"type": "n8n-nodes-base.httpRequest",
"position": [
3408,
680
],
"parameters": {
"url": "=https://api.ynab.com/v1/budgets/{{$('Variables').item.json.budget_id}}/transactions",
"method": "PATCH",
"options": {},
"jsonBody": "={\n \"transactions\": {{ JSON.stringify($json.transactions, null, 2) }}\n}",
"sendBody": true,
"sendHeaders": true,
"specifyBody": "json",
"headerParameters": {
"parameters": [
{
"name": "accept",
"value": "application/json"
},
{
"name": "Authorization",
"value": "=Bearer {{ $('Variables').item.json.api_key }}"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "960d9537-f042-4e55-b9f4-49aecff6dfab",
"name": "Loop Over Items1",
"type": "n8n-nodes-base.splitInBatches",
"position": [
2960,
608
],
"parameters": {
"options": {},
"batchSize": 10
},
"typeVersion": 3
},
{
"id": "98cd53d7-5f74-410c-a84a-93e80da98b81",
"name": "Aggregate",
"type": "n8n-nodes-base.aggregate",
"position": [
3184,
608
],
"parameters": {
"options": {},
"fieldsToAggregate": {
"fieldToAggregate": [
{
"renameField": true,
"outputFieldName": "transactions",
"fieldToAggregate": "output"
}
]
}
},
"typeVersion": 1
},
{
"id": "2925d200-77ee-4ac9-bf62-5eebc1e6ae47",
"name": "Aggregate1",
"type": "n8n-nodes-base.aggregate",
"position": [
3184,
416
],
"parameters": {
"options": {},
"fieldsToAggregate": {
"fieldToAggregate": [
{
"fieldToAggregate": "data.transactions"
}
]
}
},
"typeVersion": 1
},
{
"id": "c2347fc5-7fca-48fd-a7dc-9b962e573f16",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
336,
368
],
"parameters": {
"width": 1520,
"height": 272,
"content": "## YNAB Get Categories"
},
"typeVersion": 1
},
{
"id": "59ddf065-cafc-492a-a498-80a12c7a5413",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
336,
656
],
"parameters": {
"width": 1520,
"height": 272,
"content": "## YNAB Get Uncategorized Transactions\n"
},
"typeVersion": 1
},
{
"id": "e778a2e5-8301-464a-b226-83c27321576b",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
2528,
416
],
"parameters": {
"width": 384,
"height": 560,
"content": "## Category Matching\nLeverage Chat GPT to intelligently categorize uncategorized transactions.\nWith 4o-mini each transaction takes about 10 seconds. \nThere likely is room to speed this up. "
},
"typeVersion": 1
},
{
"id": "8a15011b-7673-42a9-94e1-da27464ef4da",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
3344,
576
],
"parameters": {
"width": 512,
"height": 304,
"content": "## Batch Upload\nBatch upload transactions.\nEach transaction will have the color changed to 'yellow' and tagged 'n8n. "
},
"typeVersion": 1
},
{
"id": "5c84c01f-7d83-41ce-8792-a104e4014f84",
"name": "Sticky Note4",
"type": "n8n-nodes-base.stickyNote",
"position": [
1920,
448
],
"parameters": {
"width": 384,
"height": 448,
"content": "## Wait\nWait for parallel API calls to complete before moving on. "
},
"typeVersion": 1
}
],
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "a93d427b-07b3-4bce-a077-ee45dbd24d2f",
"connections": {
"Merge": {
"main": [
[
{
"node": "Skip Categories, Loop Transactions",
"type": "main",
"index": 0
}
]
]
},
"Discord": {
"main": [
[]
]
},
"AI Agent1": {
"main": [
[
{
"node": "Loop Over Items1",
"type": "main",
"index": 0
}
]
]
},
"Aggregate": {
"main": [
[
{
"node": "YNAB modify transactions",
"type": "main",
"index": 0
}
]
]
},
"Variables": {
"main": [
[
{
"node": "Get Categories",
"type": "main",
"index": 0
},
{
"node": "Get Transactions",
"type": "main",
"index": 0
}
]
]
},
"Aggregate1": {
"main": [
[
{
"node": "Discord",
"type": "main",
"index": 0
}
]
]
},
"Get Categories": {
"main": [
[
{
"node": "Get Category Groups",
"type": "main",
"index": 0
}
]
]
},
"Categories Only": {
"main": [
[
{
"node": "Group Categories",
"type": "main",
"index": 0
}
]
]
},
"Get Transactions": {
"main": [
[
{
"node": "Break out Transactions",
"type": "main",
"index": 0
}
]
]
},
"Group Categories": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 0
}
]
]
},
"Loop Over Items1": {
"main": [
[
{
"node": "Aggregate1",
"type": "main",
"index": 0
}
],
[
{
"node": "Aggregate",
"type": "main",
"index": 0
}
]
]
},
"Loop Transactions": {
"main": [
[
{
"node": "AI Agent1",
"type": "main",
"index": 0
}
]
]
},
"Group Transactions": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 1
}
]
]
},
"OpenAI Chat Model2": {
"ai_languageModel": [
[
{
"node": "AI Agent1",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Get Category Groups": {
"main": [
[
{
"node": "Remove Invalid Category Groups",
"type": "main",
"index": 0
}
]
]
},
"Break out Transactions": {
"main": [
[
{
"node": "Filter out transfers and invalid transactions",
"type": "main",
"index": 0
}
]
]
},
"Hide Internal Categories": {
"main": [
[
{
"node": "Categories Only",
"type": "main",
"index": 0
}
]
]
},
"YNAB modify transactions": {
"main": [
[
{
"node": "Loop Over Items1",
"type": "main",
"index": 0
}
]
]
},
"Structured Output Parser1": {
"ai_outputParser": [
[
{
"node": "AI Agent1",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"Remove Invalid Category Groups": {
"main": [
[
{
"node": "Flatten Category Groups to Categories",
"type": "main",
"index": 0
}
]
]
},
"Skip Categories, Loop Transactions": {
"main": [
[
{
"node": "Loop Transactions",
"type": "main",
"index": 0
}
]
]
},
"When clicking \u2018Execute workflow\u2019": {
"main": [
[
{
"node": "Variables",
"type": "main",
"index": 0
}
]
]
},
"Flatten Category Groups to Categories": {
"main": [
[
{
"node": "Hide Internal Categories",
"type": "main",
"index": 0
}
]
]
},
"Filter out transfers and invalid transactions": {
"main": [
[
{
"node": "Group Transactions",
"type": "main",
"index": 0
}
]
]
}
}
}
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
discordWebhookApiopenAiApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
Ever wish that Y.N.A.B was just a little smarter when auto-categorizing your transactions?
Source: https://n8n.io/workflows/7566/ — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
Automatically publish blog content to WordPress with AI-generated branded images, internal linking, and client reporting using Google Sheets, OpenAI, and Gemini
This n8n workflow is designed for e-commerce businesses, digital marketers, and content creators who want to automatically generate professional 3D product videos from product images. It's perfect for
🎯 Create viral TikToks, Shorts, Reels, podcasts, and ASMR videos in minutes — all on autopilot.
Generate AI viral videos with NanoBanana & VEO3, shared on socials via Blotato 2. Uses @blotato/n8n-nodes-blotato, googleSheets, lmChatOpenAi, toolThink. Event-driven trigger; 94 nodes.
RAG CHATBOT Main. Uses telegram, telegramTrigger, lmChatOpenAi, n8n-nodes-mcp. Event-driven trigger; 87 nodes.