Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save eallion/4e7ed09ab48b774628b21b9e67efe124 to your computer and use it in GitHub Desktop.

Select an option

Save eallion/4e7ed09ab48b774628b21b9e67efe124 to your computer and use it in GitHub Desktop.
n8n_sync_mastodon_to_memos_blinko_github_notion_json
{
"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",
"webhookId": "9ff50c37-7f1a-4dcd-97b8-ffffffffffff"
},
{
"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": {
"id": "yMk6anKY2TB7FkJe",
"name": "Aliyun OSS eallion.bucket"
}
},
"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": {
"id": "yMk6anKY2TB7FkJe",
"name": "Aliyun OSS eallion.bucket"
}
},
"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// 检查 media_attachments 是否存在且不为空\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// 将 neodbCover 添加到 markdownContent 的末尾\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": "// 获取两个节点的数据\nconst tootData = $('Status to Markdown').first().json.toot_data || '';\nconst memosData = $('Memos to Markdown').first().json.memos_data || '';\n\n// 拼接文本\nconst resultText = `忽略前面的所有内容,比较文本 1 和文本 2 的相似度,文本内容用 3 个短横杠隔开,文本 1: --- ${tootData} --- 文本 2: --- ${memosData} --- ,忽略文本中的 markdown 语法的图片链接:\\`[]()\\`,如果文本小于 10 个字,就要严格判断相似度,如果文本超过 10 个字,可以适当放松相似度,如果文本中带有超级链接 URL,要严格对比 URL。对比结果:如果相似就回答数字 1,如果不相似就回答数字 0,除了数字 1 或者数字 0 不能回答其他任何内容。`;\n\n// 返回结果\nreturn {\n json: {\n messages: [\n {\"role\": \"system\", \"content\": \"是一个比较文本相似度的助手\"},\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": "// 获取 mix_content 和 createdAt\nconst mixContent = $('Mix Content').first().json.mix_content || '';\nconst createdAt = $('Fetch Latest Mastodon').first().json.body[0].created_at || '';\n\n// 拼接成指定的 JSON 格式\nconst memosPost = {\n content: mixContent,\n visibility: \"PUBLIC\"\n};\n\n// 返回结果\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": "// 获取 mix_content 和 createdAt\nconst mixContent = $('Mix Content').first().json.mix_content || '';\nconst createdAt = $('Fetch Latest Mastodon').first().json.body[0].created_at || '';\n\n// 拼接成指定的 JSON 格式\nconst blinkoPost = {\n content: mixContent,\n type: 1,\n isShare: true,\n createdAt: createdAt\n};\n\n// 返回结果\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,
"webhookId": "753a7155-f12d-4baa-bf5b-36b0141adaf1",
"credentials": {
"githubApi": {
"id": "8qzxqmikk9WEzTtg",
"name": "GitHub account"
}
},
"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": {
"id": "7xfO6YTx6dMD2LpJ",
"name": "Notion account"
}
}
},
{
"parameters": {
"jsCode": "// 获取 mix_content 和 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// 解析 created_at 时间戳\nconst date = new Date(createdAt);\nconst year = date.getFullYear();\nconst month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从 0 开始,需要加 1,并补零\nconst day = String(date.getDate()).padStart(2, '0'); // 补零\n\n// 拼接文件路径\nconst githubFilePath = `${year}/${month}/${day}/${ID}.md`;\nconst notionFilePath = `${ID}`;\n\n// 返回结果\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 ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
]
},
"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// 提取 content 中的第一个包含 neodb.social 的 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// 将 API URL 传递给下一个节点\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"
}
],
"pinData": {},
"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",
"meta": {
"instanceId": "f9ad6c4f03ea7c2c4f16a8dda8e47b847dcd27971aa32eadc1xxxxxxxxxxxx"
},
"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"
}
]
}
@eallion
Copy link
Author

eallion commented Jun 11, 2025

n8n-sync

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment