{
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "f966f105-0988-437e-bebe-84121c89dfe9",
      "name": "When chat message received",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        -976,
        2560
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.3
    },
    {
      "id": "294fd612-26cd-4383-9581-4f6e669eaac6",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -784,
        2960
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o",
          "cachedResultName": "gpt-4o"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "044ac4e0-5e78-41af-a732-3f584c2779a6",
      "name": "Get many posts in Reddit",
      "type": "n8n-nodes-base.redditTool",
      "position": [
        -224,
        2976
      ],
      "parameters": {
        "limit": 10,
        "filters": {},
        "operation": "getAll",
        "subreddit": "n8n"
      },
      "credentials": {
        "redditOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "df6bb5d2-ac16-4efc-bdba-2be080ee9278",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1200,
        2304
      ],
      "parameters": {
        "color": 7,
        "width": 1216,
        "height": 928,
        "content": "# \ud83d\udccb Chat with Reddit (AI + Reddit API)\n\nThis workflow lets you **chat with Reddit** using OpenAI and the Reddit API.  \nThe chatbot pulls posts from a subreddit and uses GPT to answer your questions.\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "e22689e8-1ff1-4316-aea2-b1a27a870399",
      "name": "Sticky Note25",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1648,
        2304
      ],
      "parameters": {
        "width": 400,
        "height": 928,
        "content": "\n## \u2699\ufe0f Setup Instructions\n\n### 2\ufe0f\u20e3 Set Up OpenAI Connection\n1. Go to [OpenAI Platform](https://platform.openai.com/api-keys)  \n2. Navigate to [OpenAI Billing](https://platform.openai.com/settings/organization/billing/overview)  \n3. Add funds to your billing account  \n4. Copy your API key into the **OpenAI credentials** in n8n  \n\n---\n\n### 2\ufe0f\u20e3 Set Up Reddit API\n1. Go to [Reddit Apps](https://www.reddit.com/prefs/apps)  \n2. Click **Create App** \u2192 Choose **script** type  \n3. Fill in:  \n   - **Name**: (your choice)  \n   - **Redirect URI**: `http://localhost:8080` (or your n8n URL)  \n   - Save \u2192 copy **Client ID** and **Secret**  \n4. In **n8n \u2192 Credentials \u2192 New \u2192 Reddit OAuth2 API**  \n   - Enter **Client ID** + **Client Secret**  \n   - Log in with your Reddit account and approve access  \n5. Attach this credential to the **Reddit Tool** node  \n\n\n\n## \ud83d\udcec Contact\nNeed help customizing this (e.g., targeting multiple subreddits or filtering posts)?  \n\n- \ud83d\udce7 **robert@ynteractive.com**  \n- \ud83d\udd17 **[Robert Breen](https://www.linkedin.com/in/robert-breen-29429625/)**  \n- \ud83c\udf10 **[ynteractive.com](https://ynteractive.com)**\n"
      },
      "typeVersion": 1
    },
    {
      "id": "3b3755cb-eb84-4f10-8419-a18496290b6c",
      "name": "Reddit Chatbot",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -736,
        2512
      ],
      "parameters": {
        "options": {
          "systemMessage": "use the reddit tool to answer user questions. "
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "ce415562-f1df-4f57-83ab-56de33c5723c",
      "name": "Sticky Note56",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -896,
        2784
      ],
      "parameters": {
        "color": 3,
        "width": 288,
        "height": 304,
        "content": "### 2\ufe0f\u20e3 Set Up OpenAI Connection\n1. Go to [OpenAI Platform](https://platform.openai.com/api-keys)  \n2. Navigate to [OpenAI Billing](https://platform.openai.com/settings/organization/billing/overview)  \n3. Add funds to your billing account  \n4. Copy your API key into the **OpenAI credentials** in n8n  "
      },
      "typeVersion": 1
    },
    {
      "id": "52718d5c-52a0-466f-9603-c586b9c6cb4d",
      "name": "Sticky Note26",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -336,
        2528
      ],
      "parameters": {
        "color": 3,
        "width": 288,
        "height": 624,
        "content": "### 2\ufe0f\u20e3 Set Up Reddit API\n1. Go to [Reddit Apps](https://www.reddit.com/prefs/apps)  \n2. Click **Create App** \u2192 Choose **script** type  \n3. Fill in:  \n   - **Name**: (your choice)  \n   - **Redirect URI**: `http://localhost:8080` (or your n8n URL)  \n   - Save \u2192 copy **Client ID** and **Secret**  \n4. In **n8n \u2192 Credentials \u2192 New \u2192 Reddit OAuth2 API**  \n   - Enter **Client ID** + **Client Secret**  \n   - Log in with your Reddit account and approve access  \n5. Attach this credential to the **Reddit Tool** node  \n"
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Reddit Chatbot",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Get many posts in Reddit": {
      "ai_tool": [
        [
          {
            "node": "Reddit Chatbot",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "Reddit Chatbot",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}