{
  "id": "sxRlIRndZi2DWwDM",
  "name": "Get Xiaohongshu user published notes with JustOneAPI",
  "tags": [],
  "nodes": [
    {
      "id": "76ced660-f13e-4548-bc52-a439be473bc3",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1680,
        304
      ],
      "parameters": {
        "width": 480,
        "height": 544,
        "content": "## Get Xiaohongshu user published notes with JustOneAPI\n\n### How it works\n\n1. Trigger the workflow manually.\n2. Prepare API and research inputs for the Xiaohongshu API call.\n3. Fetch Xiaohongshu published notes via HTTP request.\n4. Output raw published notes data and build a processed notes list.\n5. Output the final processed published notes.\n\n### Setup steps\n\n- - [ ] Configure the Manual Execution Trigger node to start the workflow.\n- [ ] Set up the Prepare API and Research Inputs node with the correct API endpoint and parameters.\n- [ ] Ensure the Fetch Xiaohongshu Published Notes node has the correct authentication for the JustOneAPI.\n- [ ] Configure the Build Published Notes List node with the required code to process the data.\n\n### Customization\n\nYou can customize the API endpoint in the Prepare API and Research Inputs node and adjust the data processing logic in the Build Published Notes List node."
      },
      "typeVersion": 1
    },
    {
      "id": "a1b50e94-a667-4f25-886c-8d604ff7a5ca",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2240,
        304
      ],
      "parameters": {
        "color": 7,
        "height": 96,
        "content": "## Workflow Trigger\n\nInitiates the workflow manually."
      },
      "typeVersion": 1
    },
    {
      "id": "e181d4ef-4cac-45a8-b14a-820dc52ff8ea",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2512,
        304
      ],
      "parameters": {
        "color": 7,
        "width": 272,
        "height": 128,
        "content": "## Prepare API Inputs\n\nSets up the necessary API and research inputs for the Xiaohongshu API call."
      },
      "typeVersion": 1
    },
    {
      "id": "06439571-233e-4729-a8d0-5bf8402397dd",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2816,
        304
      ],
      "parameters": {
        "color": 7,
        "width": 256,
        "content": "## Fetch Xiaohongshu Data\n\nMakes an HTTP request to fetch the published notes from Xiaohongshu via JustOneAPI."
      },
      "typeVersion": 1
    },
    {
      "id": "81bc85c9-97f0-4b84-a2e2-33a8620427ac",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3136,
        304
      ],
      "parameters": {
        "color": 7,
        "height": 112,
        "content": "## Output Raw Data\n\nOutputs the raw data received from the Xiaohongshu API."
      },
      "typeVersion": 1
    },
    {
      "id": "de0bd655-2fa1-462e-af90-c7b2f959cfb0",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3472,
        304
      ],
      "parameters": {
        "color": 7,
        "height": 128,
        "content": "## Process Notes Data\n\nProcesses the raw data to build a list of published notes."
      },
      "typeVersion": 1
    },
    {
      "id": "f7b3e670-35c1-4aa9-80fd-6a3ea8b370de",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3952,
        304
      ],
      "parameters": {
        "color": 7,
        "height": 112,
        "content": "## Output Final Data\n\nOutputs the final processed list of published notes."
      },
      "typeVersion": 1
    },
    {
      "id": "7fd1c6f3-7eef-403d-b279-ee171770ec01",
      "name": "Start Workflow",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        2256,
        480
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "18c50fca-f29e-4160-9a37-150cba241d97",
      "name": "Set API Request Parameters",
      "type": "n8n-nodes-base.set",
      "position": [
        2544,
        480
      ],
      "parameters": {
        "mode": "raw",
        "options": {},
        "jsonOutput": "{\n  \"baseUrl\": \"https://api.justoneapi.com\",\n  \"token\": \"YOUR_JUSTONEAPI_TOKEN\",\n  \"userId\": \"TARGET_XIAOHONGSHU_USER_ID\",\n  \"lastCursor\": \"\"\n}"
      },
      "typeVersion": 3.4
    },
    {
      "id": "a92839b6-b9a8-4a37-b9d2-0f3d12716ee2",
      "name": "Fetch User Notes from JustOneAPI",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2832,
        480
      ],
      "parameters": {
        "url": "={{$json.baseUrl + '/api/xiaohongshu/get-user-note-list/v4'}}",
        "options": {
          "redirect": {
            "redirect": {}
          }
        },
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "token",
              "value": "={{$json.token}}"
            },
            {
              "name": "userId",
              "value": "={{$json.userId}}"
            },
            {
              "name": "lastCursor",
              "value": "={{$json.lastCursor}}"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "cf1a2008-d2b0-4a10-b7d0-b75332c1e50e",
      "name": "Store Raw API Response Data",
      "type": "n8n-nodes-base.set",
      "position": [
        3168,
        688
      ],
      "parameters": {
        "mode": "raw",
        "options": {},
        "jsonOutput": "={{$json}}"
      },
      "typeVersion": 3.4
    },
    {
      "id": "ac2571ce-8f7c-4ac6-a104-3e60de742709",
      "name": "Process Notes into Structured List",
      "type": "n8n-nodes-base.code",
      "position": [
        3504,
        480
      ],
      "parameters": {
        "jsCode": "const rows = $input.all();\n\nreturn rows.map(item => {\n  const root = item.json || {};\n  const data = root.data || {};\n  const notes = Array.isArray(data.notes) ? data.notes : [];\n\n  const cleanNotes = notes.map(note => {\n    const images = Array.isArray(note.images_list) ? note.images_list : [];\n    const firstImage = images[0] || {};\n    const user = note.user || {};\n\n    return {\n      noteId: note.id || '',\n      title: note.title || '',\n      displayTitle: note.display_title || '',\n      desc: note.desc || '',\n      type: note.type || '',\n      likedCount: note.likes ?? 0,\n      commentCount: note.comments_count ?? 0,\n      collectedCount: note.collected_count ?? 0,\n      shareCount: note.share_count ?? 0,\n      viewCount: note.view_count ?? 0,\n      createTime: note.create_time ?? 0,\n      timeDesc: note.time_desc || '',\n      noteCursor: note.cursor || '',\n      sticky: note.sticky ?? false,\n      hasMusic: note.has_music ?? false,\n      ipLocation: note.ip_location || '',\n      authorUserId: user.userid || '',\n      authorNickname: user.nickname || '',\n      coverUrl: firstImage.url || '',\n      coverLargeUrl: firstImage.url_size_large || '',\n      noteUrl: note.id ? `https://www.xiaohongshu.com/explore/${note.id}` : '',\n      raw: note\n    };\n  });\n\n  const nextCursor = cleanNotes.length > 0\n    ? (cleanNotes[cleanNotes.length - 1].noteCursor || '')\n    : '';\n\n  return {\n    json: {\n      requestedUserId: $('Set API Request Parameters').first().json.userId || '',\n      returnedNoteCount: cleanNotes.length,\n      hasMore: data.has_more ?? false,\n      nextCursor,\n      notes: cleanNotes,\n      raw: root\n    }\n  };\n});"
      },
      "typeVersion": 2
    },
    {
      "id": "a6e4db78-be4d-4a45-b7b5-ddad5377f686",
      "name": "Store Final Processed Notes",
      "type": "n8n-nodes-base.set",
      "position": [
        4000,
        480
      ],
      "parameters": {
        "mode": "raw",
        "options": {},
        "jsonOutput": "={{$json}}"
      },
      "typeVersion": 3.4
    }
  ],
  "active": false,
  "settings": {
    "binaryMode": "separate",
    "executionOrder": "v1"
  },
  "versionId": "220ad45d-db77-4b09-b356-d1542b246897",
  "connections": {
    "Start Workflow": {
      "main": [
        [
          {
            "node": "Set API Request Parameters",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set API Request Parameters": {
      "main": [
        [
          {
            "node": "Fetch User Notes from JustOneAPI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch User Notes from JustOneAPI": {
      "main": [
        [
          {
            "node": "Store Raw API Response Data",
            "type": "main",
            "index": 0
          },
          {
            "node": "Process Notes into Structured List",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Process Notes into Structured List": {
      "main": [
        [
          {
            "node": "Store Final Processed Notes",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}