-
-
Save danielraffel/eee67fed05a48a5291a1615431498215 to your computer and use it in GitHub Desktop.
Summarize Omnivore bookmarks with Gemini API: Requires using a personal Google Gemini API Key (and does not use OpenRouter)
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": "Gemini 1.5 Pro copy NO KEY", | |
"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": "f41dab78-7e18-4d00-b9dd-fb70843362a6", | |
"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": "ba14645b-6b97-4fc3-b4b9-2a01295d0996", | |
"name": "Webhook1", | |
"type": "n8n-nodes-base.webhook", | |
"typeVersion": 1, | |
"position": [ | |
-40, | |
480 | |
], | |
"webhookId": "fe3c29af-d95b-445d-9e9e-68a775513b9d" | |
}, | |
{ | |
"parameters": { | |
"conditions": { | |
"string": [ | |
{ | |
"value1": "={{ $json[\"body\"][\"page\"][\"state\"] }}", | |
"value2": "SUCCEEDED" | |
} | |
] | |
} | |
}, | |
"id": "a8884022-5cb6-46b9-ba14-158694fde406", | |
"name": "IF", | |
"type": "n8n-nodes-base.if", | |
"typeVersion": 1, | |
"position": [ | |
200, | |
480 | |
] | |
}, | |
{ | |
"parameters": { | |
"html": "={{ $json[\"data\"][\"article\"][\"article\"][\"content\"] }}", | |
"options": { | |
"ignore": "img" | |
} | |
}, | |
"id": "cc91d47c-fb87-4c9f-85ee-84eb35134b65", | |
"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": "4874f696-ddff-45b9-abd7-5e9c1d968490", | |
"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\nif ($input.item.json.candidates && $input.item.json.candidates.length > 0) {\n $input.item.json.message = \"###### Summary \\\\n\" + $input.item.json.candidates[0].content.parts[0].text;\n} else {\n $input.item.json.message = \"###### Summary \\\\nNo summary available\";\n}\n\nreturn $input.item;\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\n// return $input.item;" | |
}, | |
"id": "71104522-d7a1-497b-937e-637738f58f6a", | |
"name": "Code", | |
"type": "n8n-nodes-base.code", | |
"typeVersion": 2, | |
"position": [ | |
1120, | |
460 | |
] | |
}, | |
{ | |
"parameters": { | |
"method": "POST", | |
"url": "https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-pro-latest:generateContent", | |
"sendQuery": true, | |
"queryParameters": { | |
"parameters": [ | |
{ | |
"name": "key", | |
"value": "API_KEY" // Update this with your Gemini 1.5 PRO API key | |
} | |
] | |
}, | |
"sendBody": true, | |
"specifyBody": "json", | |
"jsonBody": "={\n \"contents\": [\n {\n \"parts\": [\n {\n \"text\": {{ JSON.stringify($json[\"data\"]) }}\n }\n ]\n }\n ]\n}", | |
"options": {} | |
}, | |
"id": "e19f35d3-af0b-40a0-a7be-827dc44a3b28", | |
"name": "Gemini AI3", | |
"type": "n8n-nodes-base.httpRequest", | |
"typeVersion": 4.1, | |
"position": [ | |
920, | |
460 | |
], | |
"continueOnFail": true | |
} | |
], | |
"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": "Gemini AI3", | |
"type": "main", | |
"index": 0 | |
} | |
] | |
] | |
}, | |
"Code": { | |
"main": [ | |
[ | |
{ | |
"node": "HTTP Request1", | |
"type": "main", | |
"index": 0 | |
} | |
] | |
] | |
}, | |
"Gemini AI3": { | |
"main": [ | |
[ | |
{ | |
"node": "Code", | |
"type": "main", | |
"index": 0 | |
} | |
] | |
] | |
} | |
}, | |
"active": false, | |
"settings": { | |
"executionOrder": "v1" | |
}, | |
"versionId": "347566f5-485a-425f-bf33-8de54854bf6f", | |
"id": "VDTC6WUYavtcAfvt", | |
"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