{
  "name": "Mastodon2MemosGitHubNotion",
  "nodes": [
    {
      "parameters": {
        "multipleMethods": true,
        "path": "9ff50c37-7f1a-4dcd-97b8-ffffffffffff",
        "options": {}
      },
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        -1100,
        640
      ],
      "id": "21943c09-92db-418f-8980-094157bc11f8",
      "name": "Webhook"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://memos.xxxxxxxxxxxx.com/api/v1/memos",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer eyJhxxxxxxxxxxxx"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ $json.memos_post }}",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1220,
        1760
      ],
      "id": "81e4fcca-0724-46f7-a010-0da69b7642e0",
      "name": "POST to Memos",
      "notesInFlow": true,
      "notes": "Post new Mastodon status to Memos"
    },
    {
      "parameters": {
        "html": "={{ $json.memos[0].content }}",
        "destinationKey": "=memos_data",
        "options": {}
      },
      "type": "n8n-nodes-base.markdown",
      "typeVersion": 1,
      "position": [
        -80,
        1320
      ],
      "id": "342cf780-71f9-4431-bf41-328c18501b53",
      "name": "Memos to Markdown",
      "retryOnFail": false,
      "executeOnce": false,
      "notesInFlow": true,
      "alwaysOutputData": true,
      "onError": "continueErrorOutput",
      "notes": "Convert Memos to Markdown"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "ce00c9a9-3ee7-4572-90ea-25b912d49345",
              "leftValue": "={{ $json.choices[0].message.content }}",
              "rightValue": "=1",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        700,
        1320
      ],
      "id": "6bf6d4d7-e714-409b-a189-d3afea821dd8",
      "name": "Duplicate",
      "notesInFlow": true,
      "executeOnce": true,
      "retryOnFail": true,
      "notes": "Check the AI Diff result"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose",
            "version": 2
          },
          "conditions": [
            {
              "id": "faf7c56a-74ef-46ae-bb25-a1e7cbff896e",
              "leftValue": "={{ $('Status to Markdown').item.json.toot_data }}",
              "rightValue": "",
              "operator": {
                "type": "string",
                "operation": "empty",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "looseTypeValidation": true,
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        700,
        1600
      ],
      "id": "554f952c-723d-468e-afa6-c978b2fc5187",
      "name": "Content Empty",
      "executeOnce": true,
      "alwaysOutputData": false,
      "retryOnFail": true,
      "notesInFlow": true,
      "notes": "Check if the Content is empty"
    },
    {
      "parameters": {
        "command": "echo \"Skipping...\""
      },
      "type": "n8n-nodes-base.executeCommand",
      "typeVersion": 1,
      "position": [
        1480,
        800
      ],
      "id": "4d2f501e-0ba2-4005-9824-665b7d533e7a",
      "name": "Exit",
      "alwaysOutputData": true,
      "retryOnFail": true,
      "notesInFlow": true,
      "notes": "Exit this workflow"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.deepseek.com/chat/completions",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer sk-xxxxxxxxxxxx"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "model",
              "value": "deepseek-chat"
            },
            {
              "name": "messages",
              "value": "={{ $json.messages }}"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        440,
        1320
      ],
      "id": "c1d6059b-d888-4d09-9430-9fc4f9ed54fd",
      "name": "AI Diff",
      "executeOnce": true,
      "retryOnFail": true,
      "alwaysOutputData": true,
      "notesInFlow": true,
      "notes": "Use AI to compare the latest MASTODON and MEMOS"
    },
    {
      "parameters": {
        "html": "={{ $('Fetch Latest Mastodon').item.json.body[0].content }}",
        "destinationKey": "=toot_data",
        "options": {}
      },
      "type": "n8n-nodes-base.markdown",
      "typeVersion": 1,
      "position": [
        -600,
        1320
      ],
      "id": "a5dc75c7-73e4-42d5-93a5-dc1a64d33369",
      "name": "Status to Markdown",
      "retryOnFail": false,
      "executeOnce": false,
      "notesInFlow": true,
      "alwaysOutputData": true,
      "notes": "Convert Status to Markdown"
    },
    {
      "parameters": {
        "method": "PATCH",
        "url": "=https://memos.xxxxxxxxxxxx.com/api/v1/{{ $json.name }}",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {}
          ]
        },
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer eyJhxxxxxxxxxxxx"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"createTime\": \"{{ $('Fetch Latest Mastodon').item.json.body[0].created_at }}\"\n} ",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1480,
        1060
      ],
      "id": "86ef3531-dc46-49ab-89a1-00107ea7e1e1",
      "name": "Sync createTime",
      "notesInFlow": true,
      "retryOnFail": true,
      "executeOnce": true,
      "notes": "Sync createTime from Mastodon API"
    },
    {
      "parameters": {
        "url": "https://xxxxxxxxxxxx.social/api/v1/accounts/xxxxxxxxxxxx/statuses",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "limit",
              "value": "1"
            }
          ]
        },
        "options": {
          "response": {
            "response": {
              "fullResponse": true,
              "responseFormat": "json"
            }
          }
        }
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        -860,
        800
      ],
      "id": "c790dc65-e395-471d-a460-6c907b78f63d",
      "name": "Fetch Latest Mastodon",
      "alwaysOutputData": true,
      "retryOnFail": true,
      "notesInFlow": true,
      "executeOnce": true,
      "notes": "Fetch latest Mastodon Status via API"
    },
    {
      "parameters": {
        "url": "https://xxxxxxxxxxxx.social/api/v1/accounts/xxxxxxxxxxxx/statuses",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "limit",
              "value": "20"
            },
            {
              "name": "exclude_replies",
              "value": "true"
            },
            {
              "name": "exclude_reblogs",
              "value": "true"
            }
          ]
        },
        "options": {
          "response": {
            "response": {
              "fullResponse": true,
              "responseFormat": "file",
              "outputPropertyName": "all_statuses"
            }
          }
        }
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1480,
        1280
      ],
      "id": "84bc2bb9-b80c-49e7-a923-a595c0b9c8d2",
      "name": "Fetch All Mastodon",
      "alwaysOutputData": true,
      "retryOnFail": true,
      "notesInFlow": true,
      "executeOnce": true,
      "notes": "Fetch All Mastodon Status via API"
    },
    {
      "parameters": {
        "url": "https://xxxxxxxxxxxx.social/api/v1/custom_emojis",
        "options": {
          "response": {
            "response": {
              "fullResponse": true,
              "responseFormat": "file",
              "outputPropertyName": "custom_emojis"
            }
          }
        }
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1480,
        1520
      ],
      "id": "197dd6cd-50a4-4008-b96a-4c20b43ab017",
      "name": "Fetch Custom Emojis",
      "alwaysOutputData": true,
      "retryOnFail": true,
      "notesInFlow": true,
      "executeOnce": true,
      "notes": "Fetch Custom Emojis via API"
    },
    {
      "parameters": {
        "operation": "upload",
        "bucketName": "eallion-bucket",
        "fileName": "api/v1/custom_emojis",
        "binaryPropertyName": "custom_emojis",
        "additionalFields": {
          "acl": "publicRead",
          "storageClass": "standard"
        }
      },
      "type": "n8n-nodes-base.s3",
      "typeVersion": 1,
      "position": [
        1780,
        1520
      ],
      "id": "ce5fb939-2556-4aaa-bdb8-6c413a2a3ad7",
      "name": "[S3] Upload Custom Emojis",
      "executeOnce": true,
      "retryOnFail": true,
      "notesInFlow": true,
      "credentials": {
        "s3": {
          "name": "<your credential>"
        }
      },
      "notes": "Upload Custom Emojis to Aliyun OSS"
    },
    {
      "parameters": {
        "operation": "upload",
        "bucketName": "eallion-bucket",
        "fileName": "api/v1/accounts/xxxxxxxxxxxx/statuses",
        "binaryPropertyName": "all_statuses",
        "additionalFields": {
          "acl": "publicRead",
          "storageClass": "standard"
        }
      },
      "type": "n8n-nodes-base.s3",
      "typeVersion": 1,
      "position": [
        1780,
        1280
      ],
      "id": "96cc6744-2fe6-4be9-9717-71a67fba4c96",
      "name": "[S3] Upload All Statuses",
      "executeOnce": true,
      "retryOnFail": true,
      "notesInFlow": true,
      "credentials": {
        "s3": {
          "name": "<your credential>"
        }
      },
      "notes": "Upload 20 Statuses to Aliyun OSS"
    },
    {
      "parameters": {
        "url": "https://memos.xxxxxxxxxxxx.com/api/v1/memos",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "pageSize",
              "value": "1"
            },
            {
              "name": "parent",
              "value": "users/101"
            }
          ]
        },
        "options": {
          "response": {
            "response": {
              "neverError": true
            }
          }
        }
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        -340,
        1320
      ],
      "id": "d5963fdb-bbe7-4cbc-af95-1971d9386594",
      "name": "Fetch Latest Memos",
      "alwaysOutputData": false,
      "retryOnFail": true,
      "notesInFlow": true,
      "executeOnce": true,
      "waitBetweenTries": 3000,
      "onError": "continueErrorOutput",
      "notes": "Fetch latest Memos via Memos API"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose",
            "version": 2
          },
          "conditions": [
            {
              "id": "b44f6098-3e0d-4d7e-8f8e-628e5b7fa6ed",
              "leftValue": "={{ $json.body[0].in_reply_to_id }}",
              "rightValue": "",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              }
            },
            {
              "id": "64b3ab42-1dc5-44b5-b0a6-236526ad74b6",
              "leftValue": "={{ $json.body[0].reblog }}",
              "rightValue": "",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              }
            }
          ],
          "combinator": "or"
        },
        "looseTypeValidation": true,
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        -600,
        800
      ],
      "id": "c16db0c6-11f2-4f8a-8aad-a1ffddde090c",
      "name": "Reply or Reblog",
      "retryOnFail": true,
      "executeOnce": true,
      "notesInFlow": true,
      "notes": "Check if it is a Reply or Reblog"
    },
    {
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "const status = $('Fetch Latest Mastodon').first().json;\nlet markdownContent = $('Status to Markdown').first().json.toot_data + '\\n\\n';\n\nlet neodbCover = null;\nif ($('Get NeoDB Cover').length > 0) {\n    neodbCover = $('Get NeoDB Cover').first().json.cover_image_url || null;\n}\n// \u68c0\u67e5 media_attachments \u662f\u5426\u5b58\u5728\u4e14\u4e0d\u4e3a\u7a7a\nif (status.body[0].media_attachments && status.body[0].media_attachments.length > 0) {\n    status.body[0].media_attachments.forEach((attachment, index) => {\n        markdownContent += `![Image ${index + 1}](${attachment.url})`;\n        if (index < status.body[0].media_attachments.length - 1) {\n            markdownContent += '\\n';\n        }\n    });\n}\n\n// \u5c06 neodbCover \u6dfb\u52a0\u5230 markdownContent \u7684\u672b\u5c3e\nif (neodbCover) {\n    markdownContent += `![NeoDB Cover](${neodbCover})`;\n}\n\nreturn {\n    json: {\n        mix_content: markdownContent\n    }\n};"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        700,
        1880
      ],
      "id": "017f0360-83a1-4e3e-92ce-b477c1afe8b4",
      "name": "Mix Content",
      "executeOnce": true,
      "retryOnFail": true,
      "notesInFlow": true,
      "notes": "Mix Text & Images into single data."
    },
    {
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "// \u83b7\u53d6\u4e24\u4e2a\u8282\u70b9\u7684\u6570\u636e\nconst tootData = $('Status to Markdown').first().json.toot_data || '';\nconst memosData = $('Memos to Markdown').first().json.memos_data || '';\n\n// \u62fc\u63a5\u6587\u672c\nconst resultText = `\u5ffd\u7565\u524d\u9762\u7684\u6240\u6709\u5185\u5bb9\uff0c\u6bd4\u8f83\u6587\u672c 1 \u548c\u6587\u672c 2 \u7684\u76f8\u4f3c\u5ea6\uff0c\u6587\u672c\u5185\u5bb9\u7528 3 \u4e2a\u77ed\u6a2a\u6760\u9694\u5f00\uff0c\u6587\u672c 1: --- ${tootData} --- \u6587\u672c 2: --- ${memosData} --- \uff0c\u5ffd\u7565\u6587\u672c\u4e2d\u7684 markdown \u8bed\u6cd5\u7684\u56fe\u7247\u94fe\u63a5\uff1a\\`[]()\\`\uff0c\u5982\u679c\u6587\u672c\u5c0f\u4e8e 10 \u4e2a\u5b57\uff0c\u5c31\u8981\u4e25\u683c\u5224\u65ad\u76f8\u4f3c\u5ea6\uff0c\u5982\u679c\u6587\u672c\u8d85\u8fc7 10 \u4e2a\u5b57\uff0c\u53ef\u4ee5\u9002\u5f53\u653e\u677e\u76f8\u4f3c\u5ea6\uff0c\u5982\u679c\u6587\u672c\u4e2d\u5e26\u6709\u8d85\u7ea7\u94fe\u63a5 URL\uff0c\u8981\u4e25\u683c\u5bf9\u6bd4 URL\u3002\u5bf9\u6bd4\u7ed3\u679c\uff1a\u5982\u679c\u76f8\u4f3c\u5c31\u56de\u7b54\u6570\u5b57 1\uff0c\u5982\u679c\u4e0d\u76f8\u4f3c\u5c31\u56de\u7b54\u6570\u5b57 0\uff0c\u9664\u4e86\u6570\u5b57 1 \u6216\u8005\u6570\u5b57 0 \u4e0d\u80fd\u56de\u7b54\u5176\u4ed6\u4efb\u4f55\u5185\u5bb9\u3002`;\n\n// \u8fd4\u56de\u7ed3\u679c\nreturn {\n    json: {\n        messages: [\n            {\"role\": \"system\", \"content\": \"\u662f\u4e00\u4e2a\u6bd4\u8f83\u6587\u672c\u76f8\u4f3c\u5ea6\u7684\u52a9\u624b\"},\n            {\"role\": \"user\", \"content\": resultText}\n        ]\n    }\n};"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        180,
        1320
      ],
      "id": "9a80840c-daad-4ad1-a71c-5c941f701b4c",
      "name": "Mix Prompt",
      "executeOnce": true,
      "retryOnFail": true,
      "notesInFlow": true,
      "notes": "Mix Prompt Content"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://blinko.xxxxxxxxxxxx.com/api/v1/note/upsert",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer eyJhxxxxxxxxxxxx"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ $json.blinko_post }}",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1220,
        2000
      ],
      "id": "7fd430a1-b62d-4191-98d3-ee19ac486c2d",
      "name": "POST to Blinko",
      "notesInFlow": true,
      "disabled": true,
      "notes": "Post new Mastodon status to Memos"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://sink.xxxxxxxxxxxx.to/api/link/create",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "authorization",
              "value": "Bearer eyJhxxxxxxxxxxxx"
            },
            {
              "name": "content-type",
              "value": "application/json"
            }
          ]
        },
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "url",
              "value": "={{ $('Status to Markdown').item.json.body[0].url }}"
            },
            {
              "name": "slug",
              "value": "=B{{ $json.id }}"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1480,
        2000
      ],
      "id": "014f0ac7-1132-48e9-858a-53be8b1a56d8",
      "name": "Sink Shortener Blinko",
      "executeOnce": true,
      "retryOnFail": true,
      "notesInFlow": true,
      "disabled": true,
      "notes": "Shorter the link with Sink"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://sink.xxxxxxxxxxxx.to/api/link/create",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "authorization",
              "value": "Bearer eyJhxxxxxxxxxxxx"
            },
            {
              "name": "content-type",
              "value": "application/json"
            }
          ]
        },
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "url",
              "value": "={{ $('Status to Markdown').item.json.body[0].url }}"
            },
            {
              "name": "slug",
              "value": "={{ $('POST to Memos').item.json.name }}"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1480,
        1760
      ],
      "id": "bc8f0bec-3ef3-41f6-9207-aa2451e8c53c",
      "name": "Sink Shortener Memos",
      "executeOnce": true,
      "retryOnFail": true,
      "notesInFlow": true,
      "disabled": true,
      "notes": "Shorter the link with Sink"
    },
    {
      "parameters": {},
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        -1100,
        960
      ],
      "id": "f7160229-8f74-4f1f-b979-f5b744a68852",
      "name": "Manual",
      "disabled": true
    },
    {
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "// \u83b7\u53d6 mix_content \u548c createdAt\nconst mixContent = $('Mix Content').first().json.mix_content || '';\nconst createdAt = $('Fetch Latest Mastodon').first().json.body[0].created_at || '';\n\n// \u62fc\u63a5\u6210\u6307\u5b9a\u7684 JSON \u683c\u5f0f\nconst memosPost = {\n    content: mixContent,\n    visibility: \"PUBLIC\"\n};\n\n// \u8fd4\u56de\u7ed3\u679c\nreturn {\n    json: {\n        memos_post: memosPost\n    }\n};"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        960,
        1760
      ],
      "id": "0bf5a1f0-1c21-4680-a846-4bb79a79fffd",
      "name": "Memos Note",
      "executeOnce": true,
      "retryOnFail": true,
      "notesInFlow": true,
      "notes": "Generate Memos Post."
    },
    {
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "// \u83b7\u53d6 mix_content \u548c createdAt\nconst mixContent = $('Mix Content').first().json.mix_content || '';\nconst createdAt = $('Fetch Latest Mastodon').first().json.body[0].created_at || '';\n\n// \u62fc\u63a5\u6210\u6307\u5b9a\u7684 JSON \u683c\u5f0f\nconst blinkoPost = {\n    content: mixContent,\n    type: 1,\n    isShare: true,\n    createdAt: createdAt\n};\n\n// \u8fd4\u56de\u7ed3\u679c\nreturn {\n    json: {\n        blinko_post: blinkoPost\n    }\n};"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        960,
        2000
      ],
      "id": "fe873a1a-80df-4c57-b5ae-7d789c6497fb",
      "name": "Blinko Note",
      "executeOnce": true,
      "retryOnFail": true,
      "notesInFlow": true,
      "disabled": true,
      "notes": "Generate Blinko Post."
    },
    {
      "parameters": {
        "content": "### I'm a note \n- n8n: [n8n-host.eallion.com](https://n8n.eallion.com)\n- Mastodon: [e5n.cc](https://e5n.cc/@eallion)\n- Memos: [memos.eallion.com](https://memos.eallion.com)\n- Blinko: [blinko.eallion.com](https://blinko.eallion.com)\n- AI: [Deepseek](https://chat.deepseek.com)\n- S3: [Aliyun OSS]()\n  ",
        "height": 180
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        200,
        580
      ],
      "typeVersion": 1,
      "id": "d6622287-a3ce-4d1e-9e76-8b3ad4c2b454",
      "name": "Sticky Note"
    },
    {
      "parameters": {
        "resource": "file",
        "owner": {
          "__rl": true,
          "value": "https://github.com/eallion",
          "mode": "url"
        },
        "repository": {
          "__rl": true,
          "value": "https://github.com/eallion/mastodon_statuses",
          "mode": "url"
        },
        "filePath": "={{ $json.github_file_name }}",
        "fileContent": "={{ $json.content }}",
        "commitMessage": "=backup: {{ $json.commit_message }}"
      },
      "type": "n8n-nodes-base.github",
      "typeVersion": 1,
      "position": [
        1220,
        2260
      ],
      "id": "c12e8e0f-2fe1-43a1-8747-61d36de1972a",
      "name": "GitHub",
      "executeOnce": true,
      "retryOnFail": true,
      "notesInFlow": true,
      "credentials": {
        "githubApi": {
          "name": "<your credential>"
        }
      },
      "notes": "Backup to GitHub"
    },
    {
      "parameters": {
        "resource": "databasePage",
        "databaseId": {
          "__rl": true,
          "value": "165d789f-e4ec-804f-8bcc-xxxxxxxxxxxx",
          "mode": "list",
          "cachedResultName": "Mastodon Statuses",
          "cachedResultUrl": "https://www.notion.so/xxxxxxxxxxxx"
        },
        "title": "={{ $json.notion_file_name }}",
        "blockUi": {
          "blockValues": [
            {
              "richText": true,
              "text": {
                "text": [
                  {
                    "text": "={{ $json.content }}",
                    "isLink": true,
                    "textLink": "={{ $json.commit_message }}",
                    "annotationUi": {}
                  }
                ]
              }
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.notion",
      "typeVersion": 2.2,
      "position": [
        1220,
        2500
      ],
      "id": "748ad8ee-e912-44f3-9613-318489706f0d",
      "name": "Notion",
      "credentials": {
        "notionApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "// \u83b7\u53d6 mix_content \u548c createdAt\nconst ID = $('Fetch Latest Mastodon').first().json.body[0].id || '';\nconst createdAt = $('Fetch Latest Mastodon').first().json.body[0].created_at || '';\nconst URL  = $('Fetch Latest Mastodon').first().json.body[0].url || '';\nconst mixContent = $('Mix Content').first().json.mix_content || ''; \n\n// \u89e3\u6790 created_at \u65f6\u95f4\u6233\nconst date = new Date(createdAt);\nconst year = date.getFullYear();\nconst month = String(date.getMonth() + 1).padStart(2, '0'); // \u6708\u4efd\u4ece 0 \u5f00\u59cb\uff0c\u9700\u8981\u52a0 1\uff0c\u5e76\u8865\u96f6\nconst day = String(date.getDate()).padStart(2, '0'); // \u8865\u96f6\n\n// \u62fc\u63a5\u6587\u4ef6\u8def\u5f84\nconst githubFilePath = `${year}/${month}/${day}/${ID}.md`;\nconst notionFilePath = `${ID}`;\n\n// \u8fd4\u56de\u7ed3\u679c\nreturn {\n    json: {\n        github_file_name: githubFilePath,\n        notion_file_name: notionFilePath,\n        content: mixContent,\n        commit_message: URL\n    }\n};"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        960,
        2260
      ],
      "id": "6c88a5f3-11bf-4a7e-a39f-5f7f435f2677",
      "name": "File Name",
      "executeOnce": true,
      "retryOnFail": true,
      "notesInFlow": true,
      "notes": "Generate GitHub File"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.github.com/repos/eallion/eallion.com/dispatches",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Accept",
              "value": "application/vnd.github+json"
            },
            {
              "name": "Authorization",
              "value": "token <redacted-credential>"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\"event_type\": \"sync-neodb\"}",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        180,
        1080
      ],
      "id": "cb714fd4-c13a-4601-ad98-d35dc8d5486e",
      "name": "NeoDB GH Actions",
      "executeOnce": true,
      "alwaysOutputData": true,
      "notesInFlow": true,
      "notes": "NeoDB GH Actions Workflow triggle"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose",
            "version": 2
          },
          "conditions": [
            {
              "id": "81d1f10c-4559-4a3f-a235-d46a1463422d",
              "leftValue": "={{ $('Fetch Latest Mastodon').item.json.body[0].tags[0].name }}",
              "rightValue": "neodb",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        },
        "looseTypeValidation": true,
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        -340,
        1080
      ],
      "id": "e281dc48-af6c-4ab6-ae9a-0bb798272788",
      "name": "Tag NeoDB",
      "executeOnce": true,
      "notesInFlow": true,
      "notes": "If tag is neodb"
    },
    {
      "parameters": {
        "command": "echo \"Success...\""
      },
      "type": "n8n-nodes-base.executeCommand",
      "typeVersion": 1,
      "position": [
        1780,
        2500
      ],
      "id": "fb42718c-eaf6-4e8b-a7db-96167d60486d",
      "name": "Success",
      "alwaysOutputData": true,
      "retryOnFail": true,
      "notesInFlow": true,
      "notes": "Exit this workflow"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose",
            "version": 2
          },
          "conditions": [
            {
              "id": "dc0e4b2f-24bc-48de-a847-994afcf22f5d",
              "leftValue": "{{ $('Fetch Latest Mastodon').item.json.body[0].tags }}",
              "rightValue": "neodb",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "looseTypeValidation": true,
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        -600,
        1080
      ],
      "id": "990a3d99-f046-442d-90f8-5a5d64210ea6",
      "name": "Has Tag",
      "executeOnce": true,
      "alwaysOutputData": true,
      "notesInFlow": true,
      "notes": "If tags is not empty"
    },
    {
      "parameters": {
        "jsCode": "const status = $('Fetch Latest Mastodon').first().json;\n\n// \u63d0\u53d6 content \u4e2d\u7684\u7b2c\u4e00\u4e2a\u5305\u542b neodb.social \u7684 URL\nlet apiUrl = null;\nif (status.body[0].content) {\n    const content = status.body[0].content;\n    const urlRegex = /https:\\/\\/neodb\\.social\\/[^\\/]+\\/[^\\s\"]+/;\n    const match = content.match(urlRegex);\n\n    if (match && match[0]) {\n        const originalUrl = match[0];\n        apiUrl = originalUrl.replace('https://neodb.social/', 'https://neodb.social/api/');\n    }\n}\n\n// \u5c06 API URL \u4f20\u9012\u7ed9\u4e0b\u4e00\u4e2a\u8282\u70b9\nreturn {\n    json: {\n        api_url: apiUrl\n    }\n};"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        440,
        1080
      ],
      "id": "72d1ddba-bf3d-4009-a10d-9d9cf7cbbdf1",
      "name": "Convert NeoDB API",
      "notesInFlow": true,
      "retryOnFail": true,
      "executeOnce": true,
      "notes": "Convert NeoDB URL to API"
    },
    {
      "parameters": {
        "url": "={{ $('Convert NeoDB API').item.json.api_url }}",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        700,
        1080
      ],
      "id": "3a702c9a-b7b4-432b-aa66-53247e1562ba",
      "name": "Get NeoDB Cover",
      "notesInFlow": true,
      "notes": "Get NeoDB Cover"
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Fetch Latest Mastodon",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Fetch Latest Mastodon",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Memos to Markdown": {
      "main": [
        [
          {
            "node": "Mix Prompt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Duplicate": {
      "main": [
        [
          {
            "node": "Exit",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Content Empty",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Content Empty": {
      "main": [
        [
          {
            "node": "Exit",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Mix Content",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "POST to Memos": {
      "main": [
        [
          {
            "node": "Sink Shortener Memos",
            "type": "main",
            "index": 0
          },
          {
            "node": "Sync createTime",
            "type": "main",
            "index": 0
          },
          {
            "node": "Fetch All Mastodon",
            "type": "main",
            "index": 0
          },
          {
            "node": "Fetch Custom Emojis",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Diff": {
      "main": [
        [
          {
            "node": "Duplicate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Status to Markdown": {
      "main": [
        [
          {
            "node": "Fetch Latest Memos",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Sync createTime": {
      "main": [
        [
          {
            "node": "Success",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Latest Mastodon": {
      "main": [
        [
          {
            "node": "Reply or Reblog",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch All Mastodon": {
      "main": [
        [
          {
            "node": "[S3] Upload All Statuses",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Custom Emojis": {
      "main": [
        [
          {
            "node": "[S3] Upload Custom Emojis",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Latest Memos": {
      "main": [
        [
          {
            "node": "Memos to Markdown",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Reply or Reblog": {
      "main": [
        [
          {
            "node": "Exit",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Has Tag",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Mix Content": {
      "main": [
        [
          {
            "node": "Blinko Note",
            "type": "main",
            "index": 0
          },
          {
            "node": "Memos Note",
            "type": "main",
            "index": 0
          },
          {
            "node": "File Name",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Mix Prompt": {
      "main": [
        [
          {
            "node": "AI Diff",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "POST to Blinko": {
      "main": [
        [
          {
            "node": "Sink Shortener Blinko",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Manual": {
      "main": [
        [
          {
            "node": "Fetch Latest Mastodon",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Memos Note": {
      "main": [
        [
          {
            "node": "POST to Memos",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Blinko Note": {
      "main": [
        [
          {
            "node": "POST to Blinko",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "File Name": {
      "main": [
        [
          {
            "node": "GitHub",
            "type": "main",
            "index": 0
          },
          {
            "node": "Notion",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "NeoDB GH Actions": {
      "main": [
        [
          {
            "node": "Convert NeoDB API",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Tag NeoDB": {
      "main": [
        [
          {
            "node": "NeoDB GH Actions",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Status to Markdown",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "[S3] Upload All Statuses": {
      "main": [
        [
          {
            "node": "Success",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "[S3] Upload Custom Emojis": {
      "main": [
        [
          {
            "node": "Success",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Sink Shortener Memos": {
      "main": [
        [
          {
            "node": "Success",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Sink Shortener Blinko": {
      "main": [
        [
          {
            "node": "Success",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "GitHub": {
      "main": [
        [
          {
            "node": "Success",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Notion": {
      "main": [
        [
          {
            "node": "Success",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Has Tag": {
      "main": [
        [
          {
            "node": "Tag NeoDB",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Status to Markdown",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert NeoDB API": {
      "main": [
        [
          {
            "node": "Get NeoDB Cover",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get NeoDB Cover": {
      "main": [
        [
          {
            "node": "Status to Markdown",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": true,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "5ced89cf-10de-4904-b0e2-252054e590d1",
  "id": "8i5ccYRT1PoJswhk",
  "tags": [
    {
      "createdAt": "2024-12-20T16:28:17.566Z",
      "updatedAt": "2024-12-20T16:28:17.566Z",
      "id": "J9TkBmgoku9JRrx9",
      "name": "blinko"
    },
    {
      "createdAt": "2024-12-20T08:28:29.138Z",
      "updatedAt": "2024-12-20T08:28:29.138Z",
      "id": "UA9ApvnMN6iS6skL",
      "name": "mastodon"
    },
    {
      "createdAt": "2024-12-20T08:28:41.153Z",
      "updatedAt": "2024-12-20T08:28:41.153Z",
      "id": "rP8SXVAuzpFgbEMK",
      "name": "webhook"
    },
    {
      "createdAt": "2024-12-20T08:28:32.825Z",
      "updatedAt": "2024-12-20T08:28:32.825Z",
      "id": "uW7SWKkSHw7Qz1z0",
      "name": "sync"
    }
  ]
}