{
  "name": "AI News & Sentiment Agent",
  "nodes": [
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "b6fbf1cf-4096-40ad-84bc-49b664dc02af",
              "name": "ticker",
              "value": "AI",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        208,
        0
      ],
      "id": "4e4a277f-00fd-4305-9bc3-a5082df64892",
      "name": "Edit Fields"
    },
    {
      "parameters": {
        "url": "https://newsapi.org/v2/everything?q=nvidia&language=en&pageSize=5&sortBy=publishedAt&apiKey=REPLACE_WITH_CREDENTIAL",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        416,
        0
      ],
      "id": "9d6ed0bd-6abb-4f26-bdeb-b569722f90b9",
      "name": "HTTP Request",
      "alwaysOutputData": false,
      "executeOnce": false
    },
    {
      "parameters": {
        "fieldToSplitOut": "articles",
        "options": {}
      },
      "type": "n8n-nodes-base.splitOut",
      "typeVersion": 1,
      "position": [
        624,
        0
      ],
      "id": "6f048b48-e0dc-4e21-91d7-2306c720766e",
      "name": "Split Out"
    },
    {
      "parameters": {
        "mode": "runOnceForEachItem",
        "language": "python",
        "pythonCode": "title = item.get(\"json\", {}).get(\"title\", \"\").lower()\n\nif \"gain\" in title or \"raise\" in title:\n    sentiment = \"positive\"\nelif \"loss\" in title or \"drop\" in title or \"fall\" in title:\n    sentiment = \"negative\"\nelse:\n    sentiment = \"neutral\"\n\nreturn {\n    \"json\": {\n        \"title\": item[\"json\"][\"title\"],\n        \"sentiment\": sentiment,\n        \"source\": item[\"json\"][\"source\"][\"name\"],\n        \"publishedAt\": item[\"json\"][\"publishedAt\"],\n        \"url\": item[\"json\"][\"url\"]\n    }\n}\n"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        832,
        0
      ],
      "id": "1adf07ed-eba0-4a5f-a0e2-dd645a4296a5",
      "name": "Code"
    },
    {
      "parameters": {
        "operation": "create",
        "base": {
          "__rl": true,
          "value": "REPLACE_WITH_RESOURCE",
          "mode": "url"
        },
        "table": {
          "__rl": true,
          "value": "REPLACE_WITH_RESOURCE",
          "mode": "url"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "title": "={{$json[\"title\"]}}",
            "sentiment": "={{$json[\"sentiment\"]}}\n",
            "source": "={{$json[\"source\"]}}",
            "url": "={{$json[\"url\"]}}",
            "publisheAt": "={{$json[\"publishedAt\"]}}"
          },
          "matchingColumns": [],
          "schema": [
            {
              "id": "title",
              "displayName": "title",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": true,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": false
            },
            {
              "id": "sentiment",
              "displayName": "sentiment",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": true,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": false
            },
            {
              "id": "source",
              "displayName": "source",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": true,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": false
            },
            {
              "id": "publisheAt",
              "displayName": "publisheAt",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": true,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": false
            },
            {
              "id": "url",
              "displayName": "url",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": true,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": false
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.airtable",
      "typeVersion": 2.1,
      "position": [
        1056,
        0
      ],
      "id": "c07aec65-0b99-4c42-9435-3ffa6162c7fe",
      "name": "Create a record"
    },
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 10
            }
          ]
        }
      },
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        0,
        0
      ],
      "id": "08fc97ef-edb9-4762-97c2-7f9b6ab79ed0",
      "name": "Schedule Trigger"
    },
    {
      "parameters": {
        "fromEmail": "REPLACE_WITH_FROMEMAIL",
        "toEmail": "REPLACE_WITH_TOEMAIL",
        "subject": "⚠️ Negative AI News Detected",
        "html": "=A negative sentiment article was found:\n\nTitle: {{$json[\"fields\"][\"title\"]}}\nSource: {{$json[\"fields\"][\"source\"]}}\nPublished At: {{$json[\"fields\"][\"publishAt\"]}}\nSentiment: {{$json[\"fields\"][\"sentiment\"].trim()}}\nLink: {{$json[\"fields\"][\"url\"]}}\n\nPlease review the article for further action.\n",
        "options": {}
      },
      "type": "n8n-nodes-base.emailSend",
      "typeVersion": 2.1,
      "position": [
        1280,
        16
      ],
      "id": "80fb8706-64dd-4507-9b55-adf11fabf011",
      "name": "Send email"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "07aa1aa9-ad87-4306-9c79-00ac7a4480b6",
              "leftValue": "=\n{{ $json.fields.sentiment }}",
              "rightValue": "negative",
              "operator": {
                "type": "string",
                "operation": "contains"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.filter",
      "typeVersion": 2.2,
      "position": [
        1248,
        -176
      ],
      "id": "5cb7d508-2add-4a77-8871-0a1bb5531d61",
      "name": "Filter",
      "alwaysOutputData": false
    },
    {
      "id": "4ebe1380-9a3b-556f-ba80-66d85ae9f449",
      "name": "Publication · Overview and setup",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -800,
        -176
      ],
      "parameters": {
        "content": "# AI News & Sentiment Agent\n\n## Purpose and structure\nThis folder contains the **AI News & Sentiment Agent** workflow. Its executable nodes use `airtable`, `code`, `emailSend`, `filter`, `httpRequest`, `scheduleTrigger`, `set`, `splitOut`. The table and connection map below are derived from the JSON, not an inferred guarantee of behavior.\n\n## Setup\nImport inactive. Configure your own credentials and replace REPLACE_WITH_* values. Review external destinations and Code nodes before running.\n\n## Entry points\nSchedule Trigger\n\n## Verification\nSanitized source candidate; not runtime-tested. This overview is generated from node metadata. Read the folder README for the connection map, credential types, and license.\n\n## Attribution\nNik Bear Brown; rights confirmed 2026-10-19\nMIT; preserve source notices.",
        "width": 700,
        "height": 800,
        "color": 1
      }
    }
  ],
  "connections": {
    "Edit Fields": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "node": "Split Out",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out": {
      "main": [
        [
          {
            "node": "Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code": {
      "main": [
        [
          {
            "node": "Create a record",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create a record": {
      "main": [
        [
          {
            "node": "Filter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter": {
      "main": [
        [
          {
            "node": "Send email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  }
}
