-
-
Save danielraffel/5f858e18add639ef1e6cfe221103f534 to your computer and use it in GitHub Desktop.
Summarize Omnivore bookmarks with Gemini API: Supports OpenRouter so you *do not* require a Google Gemini API Key
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "Omnivore Gemini 1.5 n8n Summary Workflow", | |
"nodes": [ | |
{ | |
"parameters": { | |
"method": "POST", | |
"url": "https://api-prod.omnivore.app/api/graphql", | |
"authentication": "genericCredentialType", | |
"genericAuthType": "httpHeaderAuth", | |
"sendHeaders": true, | |
"headerParameters": { | |
"parameters": [ | |
{ | |
"name": "content-type", | |
"value": "application/json" | |
} | |
] | |
}, | |
"sendBody": true, | |
"specifyBody": "json", | |
"jsonBody": "={\n \"query\": \"\\n query GetArticle(\\n $username: String!\\n $slug: String!\\n $includeFriendsHighlights: Boolean\\n ) {\\n article(username: $username, slug: $slug) {\\n ... on ArticleSuccess {\\n article {\\n ...ArticleFields\\n content\\n highlights(input: { includeFriends: $includeFriendsHighlights }) {\\n ...HighlightFields\\n }\\n labels {\\n ...LabelFields\\n }\\n recommendations {\\n ...RecommendationFields\\n }\\n }\\n }\\n ... on ArticleError {\\n errorCodes\\n }\\n }\\n }\\n \\n fragment ArticleFields on Article {\\n id\\n title\\n url\\n author\\n image\\n savedAt\\n createdAt\\n publishedAt\\n contentReader\\n originalArticleUrl\\n readingProgressPercent\\n readingProgressTopPercent\\n readingProgressAnchorIndex\\n slug\\n isArchived\\n description\\n linkId\\n state\\n wordsCount\\n }\\n\\n \\n fragment HighlightFields on Highlight {\\n id\\n type\\n shortId\\n quote\\n prefix\\n suffix\\n patch\\n color\\n annotation\\n createdByMe\\n createdAt\\n updatedAt\\n sharedAt\\n highlightPositionPercent\\n highlightPositionAnchorIndex\\n labels {\\n id\\n name\\n color\\n createdAt\\n }\\n }\\n\\n \\n fragment LabelFields on Label {\\n id\\n name\\n color\\n description\\n createdAt\\n }\\n\\n \\n fragment RecommendationFields on Recommendation {\\n id\\n name\\n note\\n user {\\n userId\\n name\\n username\\n profileImageURL\\n }\\n recommendedAt\\n }\\n\\n\",\n \"variables\":\n {\n \"username\": \"ugurcanaktepe\",\n \"slug\": \"{{ $json[\"body\"][\"page\"][\"id\"] }}\",\n \"includeFriendsHighlights\": false\n }\n}", | |
"options": {} | |
}, | |
"id": "f6a01778-2e44-4e28-9316-adbab03fcaa2", | |
"name": "HTTP Request", | |
"type": "n8n-nodes-base.httpRequest", | |
"typeVersion": 4.1, | |
"position": [ | |
460, | |
460 | |
], | |
"credentials": { | |
"httpHeaderAuth": { | |
"id": "7lUQmSHpWLMxn6s5", | |
"name": "Header Auth account" | |
} | |
} | |
}, | |
{ | |
"parameters": { | |
"httpMethod": "POST", | |
"path": "OMNIVORE_API_KEY", // Create an Omnivore account and generate a key https://omnivore.app/settings/api then update this variable with it | |
"options": {} | |
}, | |
"id": "35899a37-65cf-4c78-bbae-f66601b31439", | |
"name": "Webhook1", | |
"type": "n8n-nodes-base.webhook", | |
"typeVersion": 1, | |
"position": [ | |
-40, | |
480 | |
], | |
"webhookId": "8f1bfaab-6299-429f-a5a4-6dc2584d708d" | |
}, | |
{ | |
"parameters": { | |
"conditions": { | |
"string": [ | |
{ | |
"value1": "={{ $json[\"body\"][\"page\"][\"state\"] }}", | |
"value2": "SUCCEEDED" | |
} | |
] | |
} | |
}, | |
"id": "913cac9b-f9ff-4c3a-885c-4a901a7e5b0a", | |
"name": "IF", | |
"type": "n8n-nodes-base.if", | |
"typeVersion": 1, | |
"position": [ | |
200, | |
480 | |
] | |
}, | |
{ | |
"parameters": { | |
"html": "={{ $json[\"data\"][\"article\"][\"article\"][\"content\"] }}", | |
"options": { | |
"ignore": "img" | |
} | |
}, | |
"id": "e5270e42-653b-4c64-b5ab-0bad3e7a1dbc", | |
"name": "Markdown", | |
"type": "n8n-nodes-base.markdown", | |
"typeVersion": 1, | |
"position": [ | |
680, | |
460 | |
] | |
}, | |
{ | |
"parameters": { | |
"method": "POST", | |
"url": "https://api-prod.omnivore.app/api/graphql", | |
"authentication": "genericCredentialType", | |
"genericAuthType": "httpHeaderAuth", | |
"sendHeaders": true, | |
"headerParameters": { | |
"parameters": [ | |
{ | |
"name": "content-type", | |
"value": "application/json" | |
} | |
] | |
}, | |
"sendBody": true, | |
"contentType": "raw", | |
"rawContentType": "application/json", | |
"body": "={\"query\":\"\\n mutation CreateHighlight($input: CreateHighlightInput!) {\\n createHighlight(input: $input) {\\n ... on CreateHighlightSuccess {\\n highlight {\\n ...HighlightFields\\n }\\n }\\n\\n ... on CreateHighlightError {\\n errorCodes\\n }\\n }\\n }\\n \\n fragment HighlightFields on Highlight {\\n id\\n type\\n shortId\\n quote\\n prefix\\n suffix\\n patch\\n color\\n annotation\\n createdByMe\\n createdAt\\n updatedAt\\n sharedAt\\n highlightPositionPercent\\n highlightPositionAnchorIndex\\n labels {\\n id\\n name\\n color\\n createdAt\\n }\\n }\\n\\n \",\"variables\":{\"input\":{\"id\":\"{{ $json[\"targetUUID\"] }}\",\"shortId\":\"{{ $json[\"shortId\"] }}\",\"type\":\"NOTE\",\"articleId\":\"{{ $('HTTP Request').item.json[\"data\"][\"article\"][\"article\"][\"id\"] }}\",\"annotation\":{{ JSON.stringify($json[\"message\"]) }}}}}", | |
"options": {} | |
}, | |
"id": "a0672a41-bed6-493f-9fe4-f8f7f1ec90fe", | |
"name": "HTTP Request1", | |
"type": "n8n-nodes-base.httpRequest", | |
"typeVersion": 4.1, | |
"position": [ | |
1360, | |
460 | |
], | |
"credentials": { | |
"httpHeaderAuth": { | |
"id": "7lUQmSHpWLMxn6s5", // Create an account and generate a key https://omnivore.app/settings/api then create a credential in your n8n workflow with the name Authorization and value set to your key | |
"name": "Header Auth account" | |
} | |
} | |
}, | |
{ | |
"parameters": { | |
"mode": "runOnceForEachItem", | |
"jsCode": "// Add a new field called 'myNewField' to the JSON of the item\nfunction generateUUID() { // Public Domain/MIT\n var d = new Date().getTime();//Timestamp\n var d2 = ((typeof performance !== 'undefined') && performance.now && (performance.now()*1000)) || 0;//Time in microseconds since page-load or 0 if unsupported\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {\n var r = Math.random() * 16;//random number between 0 and 16\n if(d > 0){//Use timestamp until depleted\n r = (d + r)%16 | 0;\n d = Math.floor(d/16);\n } else {//Use microseconds since page-load if supported\n r = (d2 + r)%16 | 0;\n d2 = Math.floor(d2/16);\n }\n return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16);\n });\n}\n\nfunction makeid(length) {\n let result = '';\n const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';\n const charactersLength = characters.length;\n let counter = 0;\n while (counter < length) {\n result += characters.charAt(Math.floor(Math.random() * charactersLength));\n counter += 1;\n }\n return result;\n}\n\n$input.item.json.targetUUID = generateUUID()\n$input.item.json.shortId = makeid(8)\n$input.item.json.message = \"###### Summary \\n\" + $input.item.json.choices[0].message.content\nreturn $input.item;" | |
}, | |
"id": "631bf0e4-eefa-4249-85c0-8e0d89b2efc6", | |
"name": "Code", | |
"type": "n8n-nodes-base.code", | |
"typeVersion": 2, | |
"position": [ | |
1120, | |
460 | |
] | |
}, | |
{ | |
"parameters": { | |
"method": "POST", | |
"url": "https://openrouter.ai/api/v1/chat/completions", | |
"authentication": "genericCredentialType", | |
"genericAuthType": "httpHeaderAuth", | |
"sendHeaders": true, | |
"headerParameters": { | |
"parameters": [ | |
{ | |
"name": "Content-Type", | |
"value": "application/json" | |
} | |
] | |
}, | |
"sendBody": true, | |
"specifyBody": "json", | |
"jsonBody": "={\n \"model\": \"google/gemini-pro-1.5\",\n \"temperature\": 0.530,\n \"top_p\": 0.890,\n \"max_tokens\": 1000000,\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": {{ JSON.stringify($json[\"data\"]) }}\n }\n ]\n}", | |
"options": { | |
"batching": { | |
"batch": { | |
"batchSize": 0, | |
"batchInterval": 6000 | |
} | |
}, | |
"timeout": 30000 | |
} | |
}, | |
"id": "048b0867-1773-461e-9518-f7ae71c8e877", | |
"name": "HTTP Request2", | |
"type": "n8n-nodes-base.httpRequest", | |
"typeVersion": 4.1, | |
"position": [ | |
900, | |
460 | |
], | |
"credentials": { | |
"httpHeaderAuth": { | |
"id": "UNygTym606ZmDCGx", // Create an account and generate a key https://openrouter.ai/keys then create a credential in your n8n workflow with the name Authorization and value set to your key | |
"name": "Header Auth account 2" | |
} | |
} | |
} | |
], | |
"pinData": {}, | |
"connections": { | |
"Webhook1": { | |
"main": [ | |
[ | |
{ | |
"node": "IF", | |
"type": "main", | |
"index": 0 | |
} | |
] | |
] | |
}, | |
"IF": { | |
"main": [ | |
[ | |
{ | |
"node": "HTTP Request", | |
"type": "main", | |
"index": 0 | |
} | |
] | |
] | |
}, | |
"HTTP Request": { | |
"main": [ | |
[ | |
{ | |
"node": "Markdown", | |
"type": "main", | |
"index": 0 | |
} | |
] | |
] | |
}, | |
"Markdown": { | |
"main": [ | |
[ | |
{ | |
"node": "HTTP Request2", | |
"type": "main", | |
"index": 0 | |
} | |
] | |
] | |
}, | |
"Code": { | |
"main": [ | |
[ | |
{ | |
"node": "HTTP Request1", | |
"type": "main", | |
"index": 0 | |
} | |
] | |
] | |
}, | |
"HTTP Request2": { | |
"main": [ | |
[ | |
{ | |
"node": "Code", | |
"type": "main", | |
"index": 0 | |
} | |
] | |
] | |
} | |
}, | |
"active": true, | |
"settings": { | |
"executionOrder": "v1" | |
}, | |
"versionId": "05750c18-9d52-48ca-8adb-488cd50fcbae", | |
"id": "ptqfgByaeWZeS996", | |
"meta": { | |
"instanceId": "84c8cadeffb0e45ffb93507bd03ee1ba65b1274dc2bab04cc058f9e6a2a130e1" | |
}, | |
"tags": [ | |
{ | |
"createdAt": "2024-01-03T18:02:43.752Z", | |
"updatedAt": "2024-01-03T18:02:43.752Z", | |
"id": "Ayca8T1PQR9RksWT", | |
"name": "openrouter.ai" | |
}, | |
{ | |
"createdAt": "2024-01-03T18:02:43.757Z", | |
"updatedAt": "2024-01-03T18:02:43.757Z", | |
"id": "xToXfc8nikAb4kcM", | |
"name": "omnivore" | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment