feat: add folder support for workflows (fixes #70)
This commit is contained in:
1162
workflows/Postgres/0263_Postgres_Code_Automation_Webhook.json
Normal file
1162
workflows/Postgres/0263_Postgres_Code_Automation_Webhook.json
Normal file
File diff suppressed because it is too large
Load Diff
364
workflows/Postgres/0460_Postgres_Filter_Import_Scheduled.json
Normal file
364
workflows/Postgres/0460_Postgres_Filter_Import_Scheduled.json
Normal file
@@ -0,0 +1,364 @@
|
||||
{
|
||||
"meta": {
|
||||
"instanceId": "f4b99447bb6b56ad425b30ab755dc982ee1c258e7ce783958190eabedd1bcbb0"
|
||||
},
|
||||
"nodes": [
|
||||
{
|
||||
"id": "d496660c-88be-4130-ad6c-32e55f820af0",
|
||||
"name": "Set Default Error Workflow",
|
||||
"type": "n8n-nodes-base.postgres",
|
||||
"position": [
|
||||
1700,
|
||||
500
|
||||
],
|
||||
"parameters": {
|
||||
"table": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "workflow_entity",
|
||||
"cachedResultName": "workflow_entity"
|
||||
},
|
||||
"schema": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "public"
|
||||
},
|
||||
"columns": {
|
||||
"value": {
|
||||
"id": "={{ $json.id }}",
|
||||
"settings": "={{ JSON.stringify({ ...$json.settings, errorWorkflow: $('Set Vars').item.json.default_error_workflow_id }, null, null) }}"
|
||||
},
|
||||
"schema": [
|
||||
{
|
||||
"id": "name",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"removed": true,
|
||||
"required": true,
|
||||
"displayName": "name",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "active",
|
||||
"type": "boolean",
|
||||
"display": true,
|
||||
"removed": true,
|
||||
"required": true,
|
||||
"displayName": "active",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "nodes",
|
||||
"type": "object",
|
||||
"display": true,
|
||||
"removed": true,
|
||||
"required": true,
|
||||
"displayName": "nodes",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "connections",
|
||||
"type": "object",
|
||||
"display": true,
|
||||
"removed": true,
|
||||
"required": true,
|
||||
"displayName": "connections",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "createdAt",
|
||||
"type": "dateTime",
|
||||
"display": true,
|
||||
"removed": true,
|
||||
"required": false,
|
||||
"displayName": "createdAt",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "updatedAt",
|
||||
"type": "dateTime",
|
||||
"display": true,
|
||||
"removed": true,
|
||||
"required": false,
|
||||
"displayName": "updatedAt",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "settings",
|
||||
"type": "object",
|
||||
"display": true,
|
||||
"removed": false,
|
||||
"required": false,
|
||||
"displayName": "settings",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "staticData",
|
||||
"type": "object",
|
||||
"display": true,
|
||||
"removed": true,
|
||||
"required": false,
|
||||
"displayName": "staticData",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "pinData",
|
||||
"type": "object",
|
||||
"display": true,
|
||||
"removed": true,
|
||||
"required": false,
|
||||
"displayName": "pinData",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "versionId",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"removed": true,
|
||||
"required": false,
|
||||
"displayName": "versionId",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "triggerCount",
|
||||
"type": "number",
|
||||
"display": true,
|
||||
"removed": true,
|
||||
"required": false,
|
||||
"displayName": "triggerCount",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "id",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"removed": false,
|
||||
"required": true,
|
||||
"displayName": "id",
|
||||
"defaultMatch": true,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "meta",
|
||||
"type": "object",
|
||||
"display": true,
|
||||
"removed": true,
|
||||
"required": false,
|
||||
"displayName": "meta",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
}
|
||||
],
|
||||
"mappingMode": "defineBelow",
|
||||
"matchingColumns": [
|
||||
"id"
|
||||
]
|
||||
},
|
||||
"options": {},
|
||||
"operation": "update"
|
||||
},
|
||||
"credentials": {
|
||||
"postgres": {
|
||||
"id": "rFLN9F42378ayUmI",
|
||||
"name": "GCS:threat-intel-context/dev-n8n-conf"
|
||||
}
|
||||
},
|
||||
"retryOnFail": true,
|
||||
"typeVersion": 2.3
|
||||
},
|
||||
{
|
||||
"id": "334c557c-bc6c-44f8-85ac-3cacc145cf2f",
|
||||
"name": "Set Vars",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
1040,
|
||||
500
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "b2302801-f93e-4134-a785-47454dfe31d4",
|
||||
"name": "default_error_workflow_id",
|
||||
"type": "string",
|
||||
"value": "2fgSBCqYJyEZWtTO"
|
||||
},
|
||||
{
|
||||
"id": "efe2c80d-2b98-4a6b-8f76-7e2d5866c4ea",
|
||||
"name": "default_error_exclusion_tag",
|
||||
"type": "string",
|
||||
"value": "default_error:false"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"retryOnFail": true,
|
||||
"typeVersion": 3.3
|
||||
},
|
||||
{
|
||||
"id": "858d36f2-1024-43dd-89e9-00402fb1bae2",
|
||||
"name": "Exclude default_error:false Tagged Workflows",
|
||||
"type": "n8n-nodes-base.filter",
|
||||
"position": [
|
||||
1480,
|
||||
500
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"conditions": {
|
||||
"options": {
|
||||
"leftValue": "",
|
||||
"caseSensitive": true,
|
||||
"typeValidation": "strict"
|
||||
},
|
||||
"combinator": "and",
|
||||
"conditions": [
|
||||
{
|
||||
"id": "911501c7-18cc-4292-a4e8-fe8f8c3cb8aa",
|
||||
"operator": {
|
||||
"type": "boolean",
|
||||
"operation": "false",
|
||||
"singleValue": true
|
||||
},
|
||||
"leftValue": "={{ $json.tags.some(item => item.name === $('Set Vars').item.json.default_error_exclusion_tag) }}",
|
||||
"rightValue": ""
|
||||
},
|
||||
{
|
||||
"id": "e22db4f5-ec03-4000-a996-d3150db17a73",
|
||||
"operator": {
|
||||
"type": "string",
|
||||
"operation": "notEquals"
|
||||
},
|
||||
"leftValue": "={{ $json.settings.errorWorkflow ? $json.settings.errorWorkflow : \"\" }}",
|
||||
"rightValue": "={{ $('Set Vars').item.json.default_error_workflow_id }}"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"retryOnFail": true,
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "f0ac7515-8175-458c-9357-b5246019a22c",
|
||||
"name": "When clicking \"Test workflow\"",
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"position": [
|
||||
780,
|
||||
580
|
||||
],
|
||||
"parameters": {},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "2545b766-a0a0-4e31-9941-d51d5594aff6",
|
||||
"name": "Schedule Trigger",
|
||||
"type": "n8n-nodes-base.scheduleTrigger",
|
||||
"position": [
|
||||
780,
|
||||
400
|
||||
],
|
||||
"parameters": {
|
||||
"rule": {
|
||||
"interval": [
|
||||
{
|
||||
"field": "hours",
|
||||
"hoursInterval": 4
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"notesInFlow": false,
|
||||
"typeVersion": 1.1
|
||||
},
|
||||
{
|
||||
"id": "901e4df3-4dd3-4b92-ac09-555d51d2d7e9",
|
||||
"name": "Get All Workflows",
|
||||
"type": "n8n-nodes-base.n8n",
|
||||
"position": [
|
||||
1260,
|
||||
500
|
||||
],
|
||||
"parameters": {
|
||||
"filters": {}
|
||||
},
|
||||
"credentials": {
|
||||
"n8nApi": {
|
||||
"id": "r2RZq6ObikiqFu1y",
|
||||
"name": "n8n account"
|
||||
}
|
||||
},
|
||||
"retryOnFail": true,
|
||||
"typeVersion": 1
|
||||
}
|
||||
],
|
||||
"pinData": {},
|
||||
"connections": {
|
||||
"Set Vars": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Get All Workflows",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Schedule Trigger": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Set Vars",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Get All Workflows": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Exclude default_error:false Tagged Workflows",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"When clicking \"Test workflow\"": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Set Vars",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Exclude default_error:false Tagged Workflows": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Set Default Error Workflow",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
580
workflows/Postgres/0666_Postgres_Webhook_Create_Webhook.json
Normal file
580
workflows/Postgres/0666_Postgres_Webhook_Create_Webhook.json
Normal file
@@ -0,0 +1,580 @@
|
||||
{
|
||||
"nodes": [
|
||||
{
|
||||
"id": "d44489b8-8cb7-4776-8c16-a8bb01e52171",
|
||||
"name": "OpenAI1",
|
||||
"type": "@n8n/n8n-nodes-langchain.openAi",
|
||||
"position": [
|
||||
300,
|
||||
-300
|
||||
],
|
||||
"parameters": {
|
||||
"text": "={{ \n JSON.parse($('Insert Transcription Part').item.json.dialog)\n .filter(item => item.date_updated && new Date(item.date_updated) >= new Date($('Insert Transcription Part').item.json.date_updated))\n .sort((a, b) => a.order - b.order)\n .map(item => `${item.words}\\n${item.speaker}`)\n .join('\\n\\n')\n}}",
|
||||
"memory": "threadId",
|
||||
"prompt": "define",
|
||||
"options": {},
|
||||
"resource": "assistant",
|
||||
"threadId": "={{ $json.thread_id }}",
|
||||
"assistantId": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "asst_D5t6bNnNpenmfC7PmvywMqyR",
|
||||
"cachedResultName": "5minAI - Realtime Agent"
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "SphXAX7rlwRLkiox",
|
||||
"name": "Test club key"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1.6
|
||||
},
|
||||
{
|
||||
"id": "3425f1c1-ad68-495e-bb9a-95ea92e7cf23",
|
||||
"name": "Insert Transcription Part",
|
||||
"type": "n8n-nodes-base.postgres",
|
||||
"position": [
|
||||
-120,
|
||||
-300
|
||||
],
|
||||
"parameters": {
|
||||
"query": "UPDATE public.data\nSET output = jsonb_set(\n output,\n '{dialog}', \n (\n COALESCE(\n (output->'dialog')::jsonb, \n '[]'::jsonb -- Initialize as empty array if dialog does not exist\n ) || jsonb_build_object(\n 'order', (COALESCE(jsonb_array_length(output->'dialog'), 0) + 1), -- Calculate the next order\n 'words', '{{ $('Webhook2').item.json.body.data.transcript.words.map(word => word.text.replace(/'/g, \"''\")).join(\" \") }}',\n 'speaker', '{{ $('Webhook2').item.json.body.data.transcript.speaker }}',\n 'language', '{{ $('Webhook2').item.json.body.data.transcript.language }}',\n 'speaker_id', ('{{ $('Webhook2').item.json.body.data.transcript.speaker_id }}')::int,\n 'date_updated', to_jsonb('{{ $now }}'::text)\n )\n )\n)\nWHERE input->>'recall_bot_id' = $1\nReturning input->>'openai_thread_id' as thread_id;",
|
||||
"options": {
|
||||
"queryReplacement": "={{ $('Scenario 2 Start - Webhook').item.json.body.data.bot_id }}"
|
||||
},
|
||||
"operation": "executeQuery"
|
||||
},
|
||||
"credentials": {
|
||||
"postgres": {
|
||||
"id": "AO9cER6p8uX7V07T",
|
||||
"name": "Postgres 5minai"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.5
|
||||
},
|
||||
{
|
||||
"id": "9bcc0605-fc35-4842-a3f4-30ef902f35c1",
|
||||
"name": "Create Note",
|
||||
"type": "n8n-nodes-base.postgresTool",
|
||||
"position": [
|
||||
180,
|
||||
-120
|
||||
],
|
||||
"parameters": {
|
||||
"query": "UPDATE public.data\nSET output = jsonb_set(\n output,\n '{notes}', \n (\n COALESCE(\n (output->'notes')::jsonb, \n '[]'::jsonb -- Initialize as empty array if dialog does not exist\n ) || jsonb_build_object(\n 'order', (COALESCE(jsonb_array_length(output->'notes'), 0) + 1), -- Calculate the next order\n 'text', '{{ $fromAI(\"note\",\"Text of note.\") }}'\n )\n )\n)\nWHERE input->>'recall_bot_id' = $1",
|
||||
"options": {
|
||||
"queryReplacement": "={{ $('Scenario 2 Start - Webhook').item.json.body.data.bot_id }}"
|
||||
},
|
||||
"operation": "executeQuery",
|
||||
"descriptionType": "manual",
|
||||
"toolDescription": "Create note record."
|
||||
},
|
||||
"credentials": {
|
||||
"postgres": {
|
||||
"id": "AO9cER6p8uX7V07T",
|
||||
"name": "Postgres 5minai"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.5
|
||||
},
|
||||
{
|
||||
"id": "0831c139-ca4b-4b4c-aa7f-7495c4ca0110",
|
||||
"name": "Create Recall bot",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
-60,
|
||||
-980
|
||||
],
|
||||
"parameters": {
|
||||
"url": "https://us-west-2.recall.ai/api/v1/bot",
|
||||
"method": "POST",
|
||||
"options": {},
|
||||
"jsonBody": "={\n \"meeting_url\":\"{{ $json.meeting_url }}\",\n \"transcription_options\": {\n \"provider\": \"assembly_ai\"\n }\n,\n\"real_time_transcription\": {\n \"destination_url\": \"https://n8n.lowcoding.dev/webhook/d074ca1e-52f9-47af-8587-8c24d431f9cd\"\n },\n\"automatic_leave\": {\n \"silence_detection\": {\n \"timeout\": 300, \n \"activate_after\": 600\n },\n \"bot_detection\": {\n \"using_participant_events\": {\n \"timeout\": 600, \n \"activate_after\": 1200\n }\n },\n \"waiting_room_timeout\": 600,\n \"noone_joined_timeout\": 600,\n \"everyone_left_timeout\": 2,\n \"in_call_not_recording_timeout\": 600,\n \"recording_permission_denied_timeout\": 600\n}\n}",
|
||||
"sendBody": true,
|
||||
"specifyBody": "json",
|
||||
"authentication": "genericCredentialType",
|
||||
"genericAuthType": "httpHeaderAuth"
|
||||
},
|
||||
"credentials": {
|
||||
"httpHeaderAuth": {
|
||||
"id": "lfHu7Kn7L7SH3LAF",
|
||||
"name": "Recall"
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.2
|
||||
},
|
||||
{
|
||||
"id": "e1122b5b-3af5-4836-802c-40c3a0eb3c93",
|
||||
"name": "Create OpenAI thread",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
140,
|
||||
-980
|
||||
],
|
||||
"parameters": {
|
||||
"url": "https://api.openai.com/v1/threads",
|
||||
"method": "POST",
|
||||
"options": {},
|
||||
"sendHeaders": true,
|
||||
"authentication": "predefinedCredentialType",
|
||||
"headerParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "OpenAI-Beta",
|
||||
"value": "assistants=v2"
|
||||
}
|
||||
]
|
||||
},
|
||||
"nodeCredentialType": "openAiApi"
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "SphXAX7rlwRLkiox",
|
||||
"name": "Test club key"
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.2
|
||||
},
|
||||
{
|
||||
"id": "784c123d-adbb-4265-9485-2c88dd3091c2",
|
||||
"name": "Create data record",
|
||||
"type": "n8n-nodes-base.supabase",
|
||||
"position": [
|
||||
320,
|
||||
-980
|
||||
],
|
||||
"parameters": {
|
||||
"tableId": "data",
|
||||
"fieldsUi": {
|
||||
"fieldValues": [
|
||||
{
|
||||
"fieldId": "input",
|
||||
"fieldValue": "={{ {\"openai_thread_id\": $('Create OpenAI thread').item.json.id, \"recall_bot_id\": $('Create Recall bot').item.json.id, \"meeting_url\":$('Webhook').item.json.body.meeting_url } }}"
|
||||
},
|
||||
{
|
||||
"fieldId": "output",
|
||||
"fieldValue": "={{ {\"dialog\":[]} }}"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"supabaseApi": {
|
||||
"id": "iVKNf5qv3ZFhq0ZV",
|
||||
"name": "Supabase 5minAI"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "f455c7de-1e64-4a28-9eef-11d19c982813",
|
||||
"name": "Sticky Note9",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-900,
|
||||
-380
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 330.5152611046425,
|
||||
"height": 239.5888196628349,
|
||||
"content": "### ... or watch set up video [10 min]\n[](https://www.youtube.com/watch?v=rtaX6BMiTeo)\n"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "ea90c110-18ad-4f4b-90ab-fcb88b92e709",
|
||||
"name": "Sticky Note7",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-1200,
|
||||
-1060
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 636,
|
||||
"height": 657,
|
||||
"content": "\n## AI Agent for realtime insights on meetings\n**Made by [Mark Shcherbakov](https://www.linkedin.com/in/marklowcoding/) from community [5minAI](https://www.skool.com/5minai)**\n\nTranscribing meetings manually can be tedious and prone to error. This workflow automates the transcription process in real-time, ensuring that key discussions and decisions are accurately captured and easily accessible for later review, thus enhancing productivity and clarity in communications.\n\nThe workflow employs an AI-powered assistant to join virtual meetings and capture discussions through real-time transcription. Key functionalities include:\n- Automatic joining of meetings on platforms like Zoom, Google Meet, and others with the ability to provide real-time transcription.\n- Integration with transcription APIs (e.g., AssemblyAI) to deliver seamless and accurate capture of dialogue.\n- Structuring and storing transcriptions efficiently in a database for easy retrieval and analysis.\n\n1. **Real-Time Transcription**: The assistant captures audio during meetings and transcribes it in real-time, allowing participants to focus on discussions.\n2. **Keyword Recognition**: Key phrases can trigger specific actions, such as noting important points or making prompts to the assistant.\n3. **Structured Data Management**: The assistant maintains a database of transcriptions linked to meeting details for organized storage and quick access later."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "378c19bb-0e4a-43d3-9ba5-2a77ebfb5b83",
|
||||
"name": "Sticky Note6",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-1200,
|
||||
-380
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 280,
|
||||
"height": 626,
|
||||
"content": "### Set up steps\n\n#### Preparation\n\n1. **Create Recall.ai API key**\n2. **Setup Supabase account and table**\n```\ncreate table\n public.data (\n id uuid not null default gen_random_uuid (),\n date_created timestamp with time zone not null default (now() at time zone 'utc'::text),\n input jsonb null,\n output jsonb null,\n constraint data_pkey primary key (id),\n ) tablespace pg_default;\n\n```\n3. **Create OpenAI API key**\n\n#### Development\n\n1. **Bot Creation**: \n - Use a node to create the bot that will join meetings. Provide the meeting URL and set transcription options within the API request.\n\n2. **Authentication**: \n - Configure authentication settings via a Bearer token for interacting with your transcription service.\n\n3. **Webhook Setup**: \n - Create a webhook to receive real-time transcription updates, ensuring timely data capture during meetings.\n\n4. **Join Meeting**: \n - Set the bot to join the specified meeting and actively listen to capture conversations.\n\n5. **Transcription Handling**: \n - Combine transcription fragments into cohesive sentences and manage dialog arrays for coherence.\n\n6. **Trigger Actions on Keywords**: \n - Set up keyword recognition that can initiate requests to the OpenAI API for additional interactions based on captured dialogue.\n\n7. **Output and Summary Generation**: \n - Produce insights and summary notes from the transcriptions that can be stored back into the database for future reference."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "9a4ff741-ccfd-42e9-883e-43297a73e2c3",
|
||||
"name": "Scenario 1 Start - Edit Fields",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
-260,
|
||||
-980
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "4891fa6e-2dd5-4433-925c-5497ec82e8ab",
|
||||
"name": "meeting_url",
|
||||
"type": "string",
|
||||
"value": "https://meet.google.com/iix-vrav-kuc"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 3.4
|
||||
},
|
||||
{
|
||||
"id": "a4368763-b96e-45e7-884d-aa0cbae2d276",
|
||||
"name": "Scenario 2 Start - Webhook",
|
||||
"type": "n8n-nodes-base.webhook",
|
||||
"position": [
|
||||
-320,
|
||||
-300
|
||||
],
|
||||
"webhookId": "7f176935-cb83-4147-ac14-48c8d747863a",
|
||||
"parameters": {
|
||||
"path": "d074ca1e-52f9-47af-8587-8c24d431f9cd",
|
||||
"options": {},
|
||||
"httpMethod": "POST"
|
||||
},
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "107b26af-d1d2-40c7-ad4f-7193d3ae9b70",
|
||||
"name": "If Jimmy word",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"position": [
|
||||
80,
|
||||
-300
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"conditions": {
|
||||
"options": {
|
||||
"version": 2,
|
||||
"leftValue": "",
|
||||
"caseSensitive": true,
|
||||
"typeValidation": "strict"
|
||||
},
|
||||
"combinator": "and",
|
||||
"conditions": [
|
||||
{
|
||||
"id": "ba6c2ae5-d0f4-4242-9cf8-97cb84335a93",
|
||||
"operator": {
|
||||
"type": "string",
|
||||
"operation": "contains"
|
||||
},
|
||||
"leftValue": "={{ $('Scenario 2 Start - Webhook').item.json.body.data.transcript.words.map(word => word.text.replace(/'/g, \"''\")).join(\" \") }}",
|
||||
"rightValue": "=Jimmy"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.2
|
||||
},
|
||||
{
|
||||
"id": "49cf34f6-86cf-42cc-9da4-3efb37e6f565",
|
||||
"name": "Sticky Note",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-380,
|
||||
-1040
|
||||
],
|
||||
"parameters": {
|
||||
"width": 920,
|
||||
"height": 400,
|
||||
"content": "## Scenario 1\n\n"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "34660f39-6ecc-4f2d-98e8-a2c529255e98",
|
||||
"name": "Sticky Note1",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-380,
|
||||
-360
|
||||
],
|
||||
"parameters": {
|
||||
"width": 1020,
|
||||
"height": 420,
|
||||
"content": "## Scenario 2\n\n"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "5027e72d-2b2c-40b4-921e-c4f40d85f251",
|
||||
"name": "Sticky Note2",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-200,
|
||||
-120
|
||||
],
|
||||
"parameters": {
|
||||
"color": 3,
|
||||
"width": 270,
|
||||
"height": 80,
|
||||
"content": "### Replace Supabase credentials"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "dddea341-da40-4b6a-ae25-a8417e869cc9",
|
||||
"name": "Sticky Note3",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-100,
|
||||
-780
|
||||
],
|
||||
"parameters": {
|
||||
"color": 3,
|
||||
"width": 200,
|
||||
"height": 80,
|
||||
"content": "### Replace server location\n\n"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "e8e76c2a-f949-400e-92b2-39da8034b471",
|
||||
"name": "Sticky Note4",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
340,
|
||||
-100
|
||||
],
|
||||
"parameters": {
|
||||
"color": 4,
|
||||
"width": 270,
|
||||
"height": 80,
|
||||
"content": "### Replace OpenAI credentials"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "729a5f6e-5aea-4908-9a82-2a7d7bea1322",
|
||||
"name": "Sticky Note5",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
140,
|
||||
-780
|
||||
],
|
||||
"parameters": {
|
||||
"color": 3,
|
||||
"width": 290,
|
||||
"height": 80,
|
||||
"content": "### Replace credentials"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "31178e90-62ce-4bf8-8381-dc8138088889",
|
||||
"name": "Sticky Note8",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-320,
|
||||
-780
|
||||
],
|
||||
"parameters": {
|
||||
"color": 3,
|
||||
"width": 200,
|
||||
"height": 80,
|
||||
"content": "### Replace meeting url\n\n"
|
||||
},
|
||||
"typeVersion": 1
|
||||
}
|
||||
],
|
||||
"pinData": {
|
||||
"Create Recall bot": [
|
||||
{
|
||||
"id": "ab35fa56-e42b-47c6-b716-eac8d12af601",
|
||||
"join_at": null,
|
||||
"metadata": {},
|
||||
"recording": null,
|
||||
"video_url": null,
|
||||
"recordings": [],
|
||||
"meeting_url": {
|
||||
"platform": "google_meet",
|
||||
"meeting_id": "zst-ymag-zoa"
|
||||
},
|
||||
"status_changes": [
|
||||
{
|
||||
"code": "ready",
|
||||
"message": null,
|
||||
"sub_code": null,
|
||||
"created_at": "2024-11-01T11:29:32.364684Z"
|
||||
}
|
||||
],
|
||||
"meeting_metadata": null,
|
||||
"calendar_meetings": [],
|
||||
"meeting_participants": []
|
||||
}
|
||||
],
|
||||
"Insert Transcription Part": [
|
||||
{
|
||||
"dialog": "[{\"order\": 1, \"words\": \"Wait.\", \"speaker\": \"Mark S.\", \"language\": null, \"speaker_id\": 100}, {\"order\": 2, \"words\": \"A bit.\", \"speaker\": \"Mark S.\", \"language\": null, \"speaker_id\": 100}, {\"order\": 3, \"words\": \"It's not even subtitles and it's not even a real. It's. A Google Meet.\", \"speaker\": \"Mark S.\", \"language\": null, \"speaker_id\": 100}, {\"order\": 4, \"words\": \"Same story. I wasn't prepared. I don't know what to tell you. Maybe my AI body can help me.\", \"speaker\": \"Mark S.\", \"language\": null, \"speaker_id\": 100}, {\"order\": 5, \"words\": \"What truth?\", \"speaker\": \"Mark S.\", \"language\": null, \"speaker_id\": 100}, {\"order\": 6, \"words\": \"You can get the same AI body in one day. Just drop AI in comment and I will. Send you a guide.\", \"speaker\": \"Mark S.\", \"language\": null, \"speaker_id\": 100}, {\"order\": 7, \"words\": \"As it works well.\", \"speaker\": \"Mark S.\", \"language\": \"null\", \"speaker_id\": 100}, {\"order\": 8, \"words\": \"As it works well.\", \"speaker\": \"Mark S.\", \"language\": \"null\", \"speaker_id\": 100}, {\"order\": 9, \"words\": \"As it works well.\", \"speaker\": \"Mark S.\", \"language\": \"null\", \"speaker_id\": 100}, {\"order\": 10, \"words\": \"Let's it works well.\", \"speaker\": \"Mark S.\", \"language\": \"null\", \"speaker_id\": 100}, {\"order\": 11, \"words\": \"Let's it works well.\", \"speaker\": \"Mark S.\", \"language\": \"null\", \"speaker_id\": 100}, {\"order\": 12, \"words\": \"Let's it works well.\", \"speaker\": \"Mark S.\", \"language\": \"null\", \"speaker_id\": 100, \"date_updated\": \"2024-11-22T08:41:24.164+01:00\"}, {\"order\": 13, \"words\": \"Let's it works well.\", \"speaker\": \"Mark S.\", \"language\": \"null\", \"speaker_id\": 100, \"date_updated\": \"2024-11-22T08:50:11.330+01:00\"}]",
|
||||
"thread_id": "thread_0g7p3iE7MYmDPiUuPiZP5vfR",
|
||||
"date_updated": "2024-11-22T08:37:55.751+01:00"
|
||||
}
|
||||
],
|
||||
"Scenario 2 Start - Webhook": [
|
||||
{
|
||||
"body": {
|
||||
"data": {
|
||||
"bot_id": "0032c6e2-78e9-46e7-a2ef-41d7b853ef48",
|
||||
"transcript": {
|
||||
"words": [
|
||||
{
|
||||
"text": "Let's",
|
||||
"end_time": 11.88,
|
||||
"start_time": 11.68
|
||||
},
|
||||
{
|
||||
"text": "it",
|
||||
"end_time": 12.12,
|
||||
"start_time": 11.88
|
||||
},
|
||||
{
|
||||
"text": "works",
|
||||
"end_time": 12.44,
|
||||
"start_time": 12.12
|
||||
},
|
||||
{
|
||||
"text": "well.",
|
||||
"end_time": 12.48,
|
||||
"start_time": 12.44
|
||||
}
|
||||
],
|
||||
"source": "smart_annotator",
|
||||
"speaker": "Mark S.",
|
||||
"is_final": true,
|
||||
"language": null,
|
||||
"speaker_id": 100,
|
||||
"original_transcript_id": 32
|
||||
},
|
||||
"recording_id": "ee1ad589-39fe-4ed5-b96f-cd14c63f3bc2"
|
||||
},
|
||||
"event": "bot.transcription"
|
||||
},
|
||||
"query": {},
|
||||
"params": {},
|
||||
"headers": {
|
||||
"host": "n8n.lowcoding.dev",
|
||||
"accept": "*/*",
|
||||
"content-type": "application/json",
|
||||
"content-length": "495",
|
||||
"accept-encoding": "gzip",
|
||||
"x-forwarded-for": "52.10.191.34",
|
||||
"x-forwarded-host": "n8n.lowcoding.dev",
|
||||
"x-forwarded-proto": "https"
|
||||
},
|
||||
"webhookUrl": "https://n8n.lowcoding.dev/webhook/d074ca1e-52f9-47af-8587-8c24d431f9cd",
|
||||
"executionMode": "production"
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"OpenAI1": {
|
||||
"main": [
|
||||
[]
|
||||
]
|
||||
},
|
||||
"Create Note": {
|
||||
"ai_tool": [
|
||||
[
|
||||
{
|
||||
"node": "OpenAI1",
|
||||
"type": "ai_tool",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"If Jimmy word": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "OpenAI1",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Create Recall bot": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Create OpenAI thread",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[]
|
||||
]
|
||||
},
|
||||
"Create data record": {
|
||||
"main": [
|
||||
[]
|
||||
]
|
||||
},
|
||||
"Create OpenAI thread": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Create data record",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Insert Transcription Part": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "If Jimmy word",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Scenario 2 Start - Webhook": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Insert Transcription Part",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Scenario 1 Start - Edit Fields": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Create Recall bot",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,258 @@
|
||||
{
|
||||
"id": "6",
|
||||
"name": "ETL pipeline",
|
||||
"nodes": [
|
||||
{
|
||||
"name": "Twitter",
|
||||
"type": "n8n-nodes-base.twitter",
|
||||
"position": [
|
||||
300,
|
||||
300
|
||||
],
|
||||
"parameters": {
|
||||
"limit": 3,
|
||||
"operation": "search",
|
||||
"searchText": "=#OnThisDay",
|
||||
"additionalFields": {}
|
||||
},
|
||||
"credentials": {
|
||||
"twitterOAuth1Api": "twitter_api"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "Postgres",
|
||||
"type": "n8n-nodes-base.postgres",
|
||||
"position": [
|
||||
1100,
|
||||
300
|
||||
],
|
||||
"parameters": {
|
||||
"table": "tweets",
|
||||
"columns": "text, score, magnitude",
|
||||
"returnFields": "=*"
|
||||
},
|
||||
"credentials": {
|
||||
"postgres": "postgres"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "MongoDB",
|
||||
"type": "n8n-nodes-base.mongoDb",
|
||||
"position": [
|
||||
500,
|
||||
300
|
||||
],
|
||||
"parameters": {
|
||||
"fields": "text",
|
||||
"options": {},
|
||||
"operation": "insert",
|
||||
"collection": "tweets"
|
||||
},
|
||||
"credentials": {
|
||||
"mongoDb": "mongodb"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "Slack",
|
||||
"type": "n8n-nodes-base.slack",
|
||||
"position": [
|
||||
1500,
|
||||
200
|
||||
],
|
||||
"parameters": {
|
||||
"text": "=🐦 NEW TWEET with sentiment score {{$json[\"score\"]}} and magnitude {{$json[\"magnitude\"]}} ⬇️\n{{$json[\"text\"]}}",
|
||||
"channel": "tweets",
|
||||
"attachments": [],
|
||||
"otherOptions": {}
|
||||
},
|
||||
"credentials": {
|
||||
"slackApi": "slack"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "IF",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"position": [
|
||||
1300,
|
||||
300
|
||||
],
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"number": [
|
||||
{
|
||||
"value1": "={{$json[\"score\"]}}",
|
||||
"operation": "larger"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "NoOp",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"position": [
|
||||
1500,
|
||||
400
|
||||
],
|
||||
"parameters": {},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "Google Cloud Natural Language",
|
||||
"type": "n8n-nodes-base.googleCloudNaturalLanguage",
|
||||
"position": [
|
||||
700,
|
||||
300
|
||||
],
|
||||
"parameters": {
|
||||
"content": "={{$node[\"MongoDB\"].json[\"text\"]}}",
|
||||
"options": {}
|
||||
},
|
||||
"credentials": {
|
||||
"googleCloudNaturalLanguageOAuth2Api": "google_nlp"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "Set",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
900,
|
||||
300
|
||||
],
|
||||
"parameters": {
|
||||
"values": {
|
||||
"number": [
|
||||
{
|
||||
"name": "score",
|
||||
"value": "={{$json[\"documentSentiment\"][\"score\"]}}"
|
||||
},
|
||||
{
|
||||
"name": "magnitude",
|
||||
"value": "={{$json[\"documentSentiment\"][\"magnitude\"]}}"
|
||||
}
|
||||
],
|
||||
"string": [
|
||||
{
|
||||
"name": "text",
|
||||
"value": "={{$node[\"Twitter\"].json[\"text\"]}}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "Cron",
|
||||
"type": "n8n-nodes-base.cron",
|
||||
"position": [
|
||||
100,
|
||||
300
|
||||
],
|
||||
"parameters": {
|
||||
"triggerTimes": {
|
||||
"item": [
|
||||
{
|
||||
"hour": 6
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
}
|
||||
],
|
||||
"active": false,
|
||||
"settings": {},
|
||||
"connections": {
|
||||
"IF": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Slack",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "NoOp",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Set": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Postgres",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Cron": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Twitter",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"MongoDB": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Google Cloud Natural Language",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Twitter": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "MongoDB",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Postgres": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "IF",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Google Cloud Natural Language": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Set",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
677
workflows/Postgres/1144_Postgres_Code_Automation_Triggered.json
Normal file
677
workflows/Postgres/1144_Postgres_Code_Automation_Triggered.json
Normal file
File diff suppressed because one or more lines are too long
@@ -0,0 +1,847 @@
|
||||
{
|
||||
"id": "AC4paL1SXMFURgmc",
|
||||
"meta": {
|
||||
"instanceId": "8a3ba313628b26e4e4cf0504ff23322f235d6b433d92e59bcf8762764730ed80",
|
||||
"templateCredsSetupCompleted": true
|
||||
},
|
||||
"name": "Translate questions about e-mails into SQL queries and run them",
|
||||
"tags": [],
|
||||
"nodes": [
|
||||
{
|
||||
"id": "dd63600a-6bee-43cd-a1d2-87aae2089ed4",
|
||||
"name": "Add table name to output",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
840,
|
||||
160
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "764176d6-3c89-404d-9c71-301e8a406a68",
|
||||
"name": "table",
|
||||
"type": "string",
|
||||
"value": "={{ $('List all tables in a database').item.json.table_name ?? 'emails_metadata'}}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"includeOtherFields": true
|
||||
},
|
||||
"typeVersion": 3.4
|
||||
},
|
||||
{
|
||||
"id": "1bf02b6d-e8e4-4b1b-8ee2-c91a8c390a21",
|
||||
"name": "Convert data to binary",
|
||||
"type": "n8n-nodes-base.convertToFile",
|
||||
"position": [
|
||||
1040,
|
||||
160
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"operation": "toJson"
|
||||
},
|
||||
"typeVersion": 1.1
|
||||
},
|
||||
{
|
||||
"id": "cf930fa2-03bd-46fa-af4d-df282262f965",
|
||||
"name": "Save file locally",
|
||||
"type": "n8n-nodes-base.readWriteFile",
|
||||
"position": [
|
||||
1220,
|
||||
160
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"fileName": "=/files/pgsql-{{ $workflow.id }}.json",
|
||||
"operation": "write"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "48bc8812-7e1b-4d08-8610-884e00069f3c",
|
||||
"name": "Extract data from file",
|
||||
"type": "n8n-nodes-base.extractFromFile",
|
||||
"position": [
|
||||
920,
|
||||
620
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"operation": "fromJson"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "0d6a0a55-a7cb-4471-ba80-a336324d2939",
|
||||
"name": "Chat Trigger",
|
||||
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
|
||||
"position": [
|
||||
260,
|
||||
520
|
||||
],
|
||||
"webhookId": "c308dec7-655c-4b79-832e-991bd8ea891f",
|
||||
"parameters": {
|
||||
"options": {}
|
||||
},
|
||||
"typeVersion": 1.1
|
||||
},
|
||||
{
|
||||
"id": "8f39276c-4ce7-4b27-b022-231607a9cfb3",
|
||||
"name": "Sticky Note",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
160,
|
||||
-60
|
||||
],
|
||||
"parameters": {
|
||||
"color": 3,
|
||||
"width": 1505,
|
||||
"height": 486,
|
||||
"content": "## This can run manually\nThis section:\n* loads a list of all tables from the database\n* extracts the database schema for each table and adds the table name\n* converts the schema into a binary JSON format\n* saves the schema file locally"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "4fb5174f-a3ed-413f-98f7-41b0b46b62ae",
|
||||
"name": "When clicking \"Test workflow\"",
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"position": [
|
||||
260,
|
||||
160
|
||||
],
|
||||
"parameters": {},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "cf6e9426-18ca-4d6e-bff2-d517ae7b4c1e",
|
||||
"name": "Combine schema data and chat input",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
1140,
|
||||
620
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "42abd24e-419a-47d6-bc8b-7146dd0b8314",
|
||||
"name": "sessionId",
|
||||
"type": "string",
|
||||
"value": "={{ $('Chat Trigger').isExecuted && $('Chat Trigger').first().json.sessionId }}"
|
||||
},
|
||||
{
|
||||
"id": "39244192-a1a6-42fe-bc75-a6fba1f264df",
|
||||
"name": "action",
|
||||
"type": "string",
|
||||
"value": "={{ $('Chat Trigger').isExecuted && $('Chat Trigger').first().json.action }}"
|
||||
},
|
||||
{
|
||||
"id": "f78c57d9-df13-43c7-89a7-5387e528107e",
|
||||
"name": "chatinput",
|
||||
"type": "string",
|
||||
"value": "={{ $('WorkflowTrigger').isExecuted ? $('WorkflowTrigger').first().json.natural_language_query: $('Chat Trigger').first().json.chatInput }}"
|
||||
},
|
||||
{
|
||||
"id": "e42b39eb-dfbd-48d9-94ed-d658bdd41454",
|
||||
"name": "schema",
|
||||
"type": "string",
|
||||
"value": "={{ $json.data }}"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"executeOnce": true,
|
||||
"typeVersion": 3.4
|
||||
},
|
||||
{
|
||||
"id": "6a960e03-ea13-4090-8ef8-9b294963fa63",
|
||||
"name": "Load the schema from the local file",
|
||||
"type": "n8n-nodes-base.readWriteFile",
|
||||
"onError": "continueRegularOutput",
|
||||
"maxTries": 2,
|
||||
"position": [
|
||||
480,
|
||||
620
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"fileSelector": "=/files/pgsql-{{ $workflow.id }}.json"
|
||||
},
|
||||
"retryOnFail": false,
|
||||
"typeVersion": 1,
|
||||
"alwaysOutputData": true
|
||||
},
|
||||
{
|
||||
"id": "0bad6e46-e8ed-4ba6-a7d9-2d69fd11227b",
|
||||
"name": "Extract SQL query",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
1740,
|
||||
620
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "ebbe194a-4b8b-44c9-ac19-03cf69d353bf",
|
||||
"name": "query",
|
||||
"type": "string",
|
||||
"value": "={{ ($json.output.match(/SELECT[^;]*/i) || [])[0] || \"\" }}"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 3.4
|
||||
},
|
||||
{
|
||||
"id": "2aa91c40-8648-4fba-899d-5599866122e3",
|
||||
"name": "Check if query exists",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"position": [
|
||||
2400,
|
||||
620
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"conditions": {
|
||||
"options": {
|
||||
"version": 2,
|
||||
"leftValue": "",
|
||||
"caseSensitive": true,
|
||||
"typeValidation": "strict"
|
||||
},
|
||||
"combinator": "and",
|
||||
"conditions": [
|
||||
{
|
||||
"id": "2963d04d-9d79-49f9-b52a-dc8732aca781",
|
||||
"operator": {
|
||||
"type": "string",
|
||||
"operation": "notEmpty",
|
||||
"singleValue": true
|
||||
},
|
||||
"leftValue": "={{ $json.query }}",
|
||||
"rightValue": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.2
|
||||
},
|
||||
{
|
||||
"id": "24b59747-7f9b-473c-9d31-660e17867986",
|
||||
"name": "Format query results",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
2840,
|
||||
460
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "f944d21f-6aac-4842-8926-4108d6cad4bf",
|
||||
"name": "sqloutput",
|
||||
"type": "string",
|
||||
"value": "={{ Object.keys($jmespath($input.all(),'[].json')[0]).join(' | ') }} \n{{ ($jmespath($input.all(),'[].json')).map(obj => Object.values(obj).join(' | ')).join('\\n') }}"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"executeOnce": true,
|
||||
"typeVersion": 3.4
|
||||
},
|
||||
{
|
||||
"id": "a25acba2-74c5-4af6-a1e4-46cfd1364b44",
|
||||
"name": "Combine query result and chat answer",
|
||||
"type": "n8n-nodes-base.merge",
|
||||
"position": [
|
||||
3060,
|
||||
540
|
||||
],
|
||||
"parameters": {
|
||||
"mode": "combine",
|
||||
"options": {
|
||||
"includeUnpaired": true
|
||||
},
|
||||
"combineBy": "combineByPosition"
|
||||
},
|
||||
"typeVersion": 3
|
||||
},
|
||||
{
|
||||
"id": "a1cde4a1-7b47-4aa2-bd2c-a7090bfb0bb2",
|
||||
"name": "List all columns in a table",
|
||||
"type": "n8n-nodes-base.postgres",
|
||||
"position": [
|
||||
640,
|
||||
160
|
||||
],
|
||||
"parameters": {
|
||||
"query": "SELECT\n column_name, \n udt_name as data_type, \n CASE WHEN data_type = 'ARRAY' THEN TRUE ELSE FALSE END AS is_array,\n is_nullable \nFROM INFORMATION_SCHEMA.COLUMNS where table_name = '{{ $json.table_name }}'",
|
||||
"options": {},
|
||||
"operation": "executeQuery"
|
||||
},
|
||||
"credentials": {},
|
||||
"typeVersion": 2.6
|
||||
},
|
||||
{
|
||||
"id": "cf167b64-007d-469a-bb3e-1144fe435a17",
|
||||
"name": "List all tables in a database",
|
||||
"type": "n8n-nodes-base.postgres",
|
||||
"position": [
|
||||
460,
|
||||
160
|
||||
],
|
||||
"parameters": {
|
||||
"query": "SELECT table_name FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='public'",
|
||||
"options": {},
|
||||
"operation": "executeQuery"
|
||||
},
|
||||
"credentials": {},
|
||||
"typeVersion": 2.6
|
||||
},
|
||||
{
|
||||
"id": "6f6fd892-d779-41d4-ac19-1d5630674f67",
|
||||
"name": "Ollama Chat Model",
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatOllama",
|
||||
"position": [
|
||||
1440,
|
||||
840
|
||||
],
|
||||
"parameters": {
|
||||
"model": "phi4-mini:latest",
|
||||
"options": {}
|
||||
},
|
||||
"credentials": {},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "6cb76f04-3183-4bce-aa15-0724205d0ab3",
|
||||
"name": "Postgres",
|
||||
"type": "n8n-nodes-base.postgres",
|
||||
"onError": "continueRegularOutput",
|
||||
"position": [
|
||||
2620,
|
||||
460
|
||||
],
|
||||
"parameters": {
|
||||
"query": "{{ $json.query }}",
|
||||
"options": {},
|
||||
"operation": "executeQuery"
|
||||
},
|
||||
"credentials": {},
|
||||
"typeVersion": 2.6,
|
||||
"alwaysOutputData": true
|
||||
},
|
||||
{
|
||||
"id": "9c2a4d74-c2e6-4fac-a00d-2a84a5150027",
|
||||
"name": "Add trailing semicolon",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
2180,
|
||||
540
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "15622b82-a226-4f54-9c0e-3f30b2c0cf4b",
|
||||
"name": "query",
|
||||
"type": "string",
|
||||
"value": "={{ $json.query }};"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 3.4
|
||||
},
|
||||
{
|
||||
"id": "7725f9c3-9c5d-41d6-b4d1-fc444122ae2f",
|
||||
"name": "Check for trailing semicolon",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"position": [
|
||||
1960,
|
||||
620
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"conditions": {
|
||||
"options": {
|
||||
"version": 2,
|
||||
"leftValue": "",
|
||||
"caseSensitive": true,
|
||||
"typeValidation": "strict"
|
||||
},
|
||||
"combinator": "and",
|
||||
"conditions": [
|
||||
{
|
||||
"id": "94bd2686-21e7-44aa-b6a8-be5a17bd0242",
|
||||
"operator": {
|
||||
"type": "string",
|
||||
"operation": "notEmpty",
|
||||
"singleValue": true
|
||||
},
|
||||
"leftValue": "={{ $json.query }}",
|
||||
"rightValue": ""
|
||||
},
|
||||
{
|
||||
"id": "f22c8914-62f3-4f15-be6f-dd23de5a099a",
|
||||
"operator": {
|
||||
"type": "string",
|
||||
"operation": "notEndsWith"
|
||||
},
|
||||
"leftValue": "={{ $json.query }}",
|
||||
"rightValue": ";"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.2
|
||||
},
|
||||
{
|
||||
"id": "c7dd1e14-a8f6-4222-a12a-802928b10f56",
|
||||
"name": "WorkflowTrigger",
|
||||
"type": "n8n-nodes-base.executeWorkflowTrigger",
|
||||
"position": [
|
||||
260,
|
||||
720
|
||||
],
|
||||
"parameters": {
|
||||
"workflowInputs": {
|
||||
"values": [
|
||||
{
|
||||
"name": "natural_language_query"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 1.1
|
||||
},
|
||||
{
|
||||
"id": "f658fbba-54e3-40f5-9217-a0c8730b1ff4",
|
||||
"name": "If ran manually",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"position": [
|
||||
1420,
|
||||
160
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"conditions": {
|
||||
"options": {
|
||||
"version": 2,
|
||||
"leftValue": "",
|
||||
"caseSensitive": true,
|
||||
"typeValidation": "strict"
|
||||
},
|
||||
"combinator": "or",
|
||||
"conditions": [
|
||||
{
|
||||
"id": "c761a475-43ac-483b-827c-0eb69dfebc9a",
|
||||
"operator": {
|
||||
"type": "boolean",
|
||||
"operation": "true",
|
||||
"singleValue": true
|
||||
},
|
||||
"leftValue": "={{ $('When clicking \"Test workflow\"').isExecuted }}",
|
||||
"rightValue": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.2
|
||||
},
|
||||
{
|
||||
"id": "67810482-afb7-47b0-ba0d-8b79a140e890",
|
||||
"name": "If file exists or already retried generating it",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"position": [
|
||||
700,
|
||||
620
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"conditions": {
|
||||
"options": {
|
||||
"version": 2,
|
||||
"leftValue": "",
|
||||
"caseSensitive": true,
|
||||
"typeValidation": "strict"
|
||||
},
|
||||
"combinator": "or",
|
||||
"conditions": [
|
||||
{
|
||||
"id": "28000886-13f4-4628-b1c0-afaaf596ec56",
|
||||
"operator": {
|
||||
"type": "object",
|
||||
"operation": "exists",
|
||||
"singleValue": true
|
||||
},
|
||||
"leftValue": "={{ $input.item.binary }}",
|
||||
"rightValue": ""
|
||||
},
|
||||
{
|
||||
"id": "ddcd8702-8774-4075-a2d0-6d99cf0cb2c2",
|
||||
"operator": {
|
||||
"type": "boolean",
|
||||
"operation": "true",
|
||||
"singleValue": true
|
||||
},
|
||||
"leftValue": "={{ $('If ran manually').isExecuted }}",
|
||||
"rightValue": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.2
|
||||
},
|
||||
{
|
||||
"id": "38121ff4-b0d2-4274-92bf-be346b71c1e9",
|
||||
"name": "Sticky Note1",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
160,
|
||||
440
|
||||
],
|
||||
"parameters": {
|
||||
"width": 720,
|
||||
"height": 540,
|
||||
"content": "## This is triggered by chat or as a sub-workflow\nNatural language requests can be asked, and a SQL query as well as its results will be returned."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "05dce292-4d93-4b0d-87e1-09e8b1dab70a",
|
||||
"name": "AI Agent",
|
||||
"type": "@n8n/n8n-nodes-langchain.agent",
|
||||
"position": [
|
||||
1360,
|
||||
620
|
||||
],
|
||||
"parameters": {
|
||||
"text": "=You have access to a database containing all my personal email and documents.\n\nToday's date is {{ $now.toLocaleString() }}\n\nThe database schema is:\n```\n{{ $json.schema }}\n```\n\nGenerate a SQL query that will:\n```\n{{ $json.chatinput }}\n```\n\nIMPORTANT: \n1. ONLY use column names that exist in the schema above\n2. NEVER invent columns or assume JSON fields that aren't listed\n3. The only metadata fields are emails_metadata.id and emails_metadata.thread_id\n4. Use operators appropriate for each data type:\n - Text fields → ILIKE '%term%'\n - Date fields → Date comparisons (>,<,BETWEEN)\n - Array fields → @>, ANY(), IS NOT NULL\n5. Output ONLY the raw SQL statement ending with a semicolon\n6. The database cannot contain emails from the future",
|
||||
"options": {
|
||||
"systemMessage": "=You are an expert SQL query generator that creates precise PostgreSQL queries based on natural language requests. You must strictly adhere to the provided database schema and NEVER invent columns that don't exist.\n\nCRITICAL SCHEMA ADHERENCE RULES:\n\n1. ONLY use columns explicitly listed in the schema\n2. The metadata fields are strictly limited to:\n - emails_metadata.id\n - emails_metadata.thread_id\n3. NEVER invent fields like \"priority\", \"category\", or any metadata attributes not in the schema\n4. NEVER use JSON operators (->>, @>) unless the schema shows JSONB columns\n\nDATA TYPE HANDLING:\n\n1. TEXT/VARCHAR FIELDS:\n - Use ILIKE '%term%' for case-insensitive pattern matching\n - Example: WHERE email_subject ILIKE '%meeting%'\n\n2. TIMESTAMP/DATE FIELDS:\n - NEVER use LIKE/ILIKE on date fields\n - \"yesterday\" → date > CURRENT_DATE - INTERVAL '1 day' AND date < CURRENT_DATE\n - \"last week\" → date > CURRENT_DATE - INTERVAL '7 days'\n - Example: WHERE date > CURRENT_DATE - INTERVAL '3 days'\n\n3. ARRAY FIELDS:\n - Use @> for checking if array contains elements\n - Example: WHERE attachments IS NOT NULL\n\n4. BOOLEAN LOGIC:\n - Always use parentheses to clarify operator precedence\n - Example: WHERE (email_subject ILIKE '%report%' OR email_text ILIKE '%report%') AND date > '2023-01-01'\n\nQUERY CONSTRUCTION GUIDELINES:\n- Start with \"SELECT * FROM\" unless specific fields are requested\n- Use ORDER BY date DESC for recency when appropriate\n- Apply LIMIT only when specifically requested or implied by quantity terms\n- End all statements with semicolons\n- Output only the raw SQL without explanations or code blocks\n- Mind the difference between emails _about_ future dates references, and emails _received_ in specific date references. The database cannot contain emails from the future.\n\nEXAMPLE QUERIES:\n1. \"recent emails about projects from Sarah with attachments\"\n SELECT * FROM emails_metadata \n WHERE (email_subject ILIKE '%project%' OR email_text ILIKE '%project%')\n AND email_from ILIKE '%sarah%' \n AND attachments IS NOT NULL\n ORDER BY date DESC;\n\n2. \"emails received yesterday\"\n SELECT * FROM emails_metadata \n WHERE date > CURRENT_DATE - INTERVAL '1 day' AND date < CURRENT_DATE;\n\n3. \"one email about budget\"\n SELECT * FROM emails_metadata \n WHERE (email_subject ILIKE '%budget%' OR email_text ILIKE '%budget%')\n LIMIT 1;\n\n4. \"Find emails about interviews scheduled from April 28 to May 4\"\n SELECT * FROM emails_metadata\n WHERE (email_subject ILIKE '%interview%' OR email_text ILIKE '%interview%');\n\n5. \"Find emails from April about interviews\"\n SELECT * FROM emails_metadata \n WHERE (email_subject ILIKE '%interview%' OR email_text ILIKE '%interview%') AND date BETWEEN '2025-04-01' AND '2025-04-30';\n\n6. \"emails in thread 123\"\n SELECT * FROM emails_metadata \n WHERE thread_id = '123';\n\n7. \"what's my latest email?\"\n SELECT * FROM emails_metadata\n ORDER BY date DESC LIMIT 1;\n"
|
||||
},
|
||||
"promptType": "define"
|
||||
},
|
||||
"typeVersion": 1.8
|
||||
},
|
||||
{
|
||||
"id": "6961fed9-4dcf-4a7f-97eb-bbf9e66dff3e",
|
||||
"name": "Format empty output",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
2620,
|
||||
760
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "aa55e186-1535-4923-aee4-e088ca69575b",
|
||||
"name": "query",
|
||||
"type": "string",
|
||||
"value": "={{ $json.query ?? '' }}"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 3.4
|
||||
},
|
||||
{
|
||||
"id": "8138aed4-e38d-4c3c-9850-a200bd4d762e",
|
||||
"name": "Sticky Note2",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1320,
|
||||
440
|
||||
],
|
||||
"parameters": {
|
||||
"width": 340,
|
||||
"height": 540,
|
||||
"content": "## Quite the prompt 😅\nSome refined prompt engineering work here.\n\nIt may or may not been done aided by Kagi's Assistant and Claude 3.7 Sonnet 👀"
|
||||
},
|
||||
"typeVersion": 1
|
||||
}
|
||||
],
|
||||
"active": false,
|
||||
"pinData": {},
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "c4e0962f-2c7f-4d14-af37-df491db2ebd0",
|
||||
"connections": {
|
||||
"AI Agent": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Extract SQL query",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Postgres": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Format query results",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Chat Trigger": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Load the schema from the local file",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"If ran manually": {
|
||||
"main": [
|
||||
[],
|
||||
[
|
||||
{
|
||||
"node": "Load the schema from the local file",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"WorkflowTrigger": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Load the schema from the local file",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Extract SQL query": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Check for trailing semicolon",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Ollama Chat Model": {
|
||||
"ai_languageModel": [
|
||||
[
|
||||
{
|
||||
"node": "AI Agent",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Save file locally": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "If ran manually",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Format query results": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Combine query result and chat answer",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Check if query exists": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Combine query result and chat answer",
|
||||
"type": "main",
|
||||
"index": 1
|
||||
},
|
||||
{
|
||||
"node": "Postgres",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Format empty output",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Add trailing semicolon": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Check if query exists",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Convert data to binary": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Save file locally",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Extract data from file": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Combine schema data and chat input",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Add table name to output": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Convert data to binary",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"List all columns in a table": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Add table name to output",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Check for trailing semicolon": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Add trailing semicolon",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Check if query exists",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"List all tables in a database": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "List all columns in a table",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"When clicking \"Test workflow\"": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "List all tables in a database",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Combine schema data and chat input": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "AI Agent",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Load the schema from the local file": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "If file exists or already retried generating it",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[]
|
||||
]
|
||||
},
|
||||
"Combine query result and chat answer": {
|
||||
"main": [
|
||||
[]
|
||||
]
|
||||
},
|
||||
"If file exists or already retried generating it": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Extract data from file",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "List all tables in a database",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
580
workflows/Postgres/1249_Postgres_Webhook_Automation_Webhook.json
Normal file
580
workflows/Postgres/1249_Postgres_Webhook_Automation_Webhook.json
Normal file
@@ -0,0 +1,580 @@
|
||||
{
|
||||
"nodes": [
|
||||
{
|
||||
"id": "d44489b8-8cb7-4776-8c16-a8bb01e52171",
|
||||
"name": "OpenAI1",
|
||||
"type": "@n8n/n8n-nodes-langchain.openAi",
|
||||
"position": [
|
||||
300,
|
||||
-300
|
||||
],
|
||||
"parameters": {
|
||||
"text": "={{ \n JSON.parse($('Insert Transcription Part').item.json.dialog)\n .filter(item => item.date_updated && new Date(item.date_updated) >= new Date($('Insert Transcription Part').item.json.date_updated))\n .sort((a, b) => a.order - b.order)\n .map(item => `${item.words}\\n${item.speaker}`)\n .join('\\n\\n')\n}}",
|
||||
"memory": "threadId",
|
||||
"prompt": "define",
|
||||
"options": {},
|
||||
"resource": "assistant",
|
||||
"threadId": "={{ $json.thread_id }}",
|
||||
"assistantId": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "asst_D5t6bNnNpenmfC7PmvywMqyR",
|
||||
"cachedResultName": "5minAI - Realtime Agent"
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "SphXAX7rlwRLkiox",
|
||||
"name": "Test club key"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1.6
|
||||
},
|
||||
{
|
||||
"id": "3425f1c1-ad68-495e-bb9a-95ea92e7cf23",
|
||||
"name": "Insert Transcription Part",
|
||||
"type": "n8n-nodes-base.postgres",
|
||||
"position": [
|
||||
-120,
|
||||
-300
|
||||
],
|
||||
"parameters": {
|
||||
"query": "UPDATE public.data\nSET output = jsonb_set(\n output,\n '{dialog}', \n (\n COALESCE(\n (output->'dialog')::jsonb, \n '[]'::jsonb -- Initialize as empty array if dialog does not exist\n ) || jsonb_build_object(\n 'order', (COALESCE(jsonb_array_length(output->'dialog'), 0) + 1), -- Calculate the next order\n 'words', '{{ $('Webhook2').item.json.body.data.transcript.words.map(word => word.text.replace(/'/g, \"''\")).join(\" \") }}',\n 'speaker', '{{ $('Webhook2').item.json.body.data.transcript.speaker }}',\n 'language', '{{ $('Webhook2').item.json.body.data.transcript.language }}',\n 'speaker_id', ('{{ $('Webhook2').item.json.body.data.transcript.speaker_id }}')::int,\n 'date_updated', to_jsonb('{{ $now }}'::text)\n )\n )\n)\nWHERE input->>'recall_bot_id' = $1\nReturning input->>'openai_thread_id' as thread_id;",
|
||||
"options": {
|
||||
"queryReplacement": "={{ $('Scenario 2 Start - Webhook').item.json.body.data.bot_id }}"
|
||||
},
|
||||
"operation": "executeQuery"
|
||||
},
|
||||
"credentials": {
|
||||
"postgres": {
|
||||
"id": "AO9cER6p8uX7V07T",
|
||||
"name": "Postgres 5minai"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.5
|
||||
},
|
||||
{
|
||||
"id": "9bcc0605-fc35-4842-a3f4-30ef902f35c1",
|
||||
"name": "Create Note",
|
||||
"type": "n8n-nodes-base.postgresTool",
|
||||
"position": [
|
||||
180,
|
||||
-120
|
||||
],
|
||||
"parameters": {
|
||||
"query": "UPDATE public.data\nSET output = jsonb_set(\n output,\n '{notes}', \n (\n COALESCE(\n (output->'notes')::jsonb, \n '[]'::jsonb -- Initialize as empty array if dialog does not exist\n ) || jsonb_build_object(\n 'order', (COALESCE(jsonb_array_length(output->'notes'), 0) + 1), -- Calculate the next order\n 'text', '{{ $fromAI(\"note\",\"Text of note.\") }}'\n )\n )\n)\nWHERE input->>'recall_bot_id' = $1",
|
||||
"options": {
|
||||
"queryReplacement": "={{ $('Scenario 2 Start - Webhook').item.json.body.data.bot_id }}"
|
||||
},
|
||||
"operation": "executeQuery",
|
||||
"descriptionType": "manual",
|
||||
"toolDescription": "Create note record."
|
||||
},
|
||||
"credentials": {
|
||||
"postgres": {
|
||||
"id": "AO9cER6p8uX7V07T",
|
||||
"name": "Postgres 5minai"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.5
|
||||
},
|
||||
{
|
||||
"id": "0831c139-ca4b-4b4c-aa7f-7495c4ca0110",
|
||||
"name": "Create Recall bot",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
-60,
|
||||
-980
|
||||
],
|
||||
"parameters": {
|
||||
"url": "https://us-west-2.recall.ai/api/v1/bot",
|
||||
"method": "POST",
|
||||
"options": {},
|
||||
"jsonBody": "={\n \"meeting_url\":\"{{ $json.meeting_url }}\",\n \"transcription_options\": {\n \"provider\": \"assembly_ai\"\n }\n,\n\"real_time_transcription\": {\n \"destination_url\": \"https://n8n.lowcoding.dev/webhook/d074ca1e-52f9-47af-8587-8c24d431f9cd\"\n },\n\"automatic_leave\": {\n \"silence_detection\": {\n \"timeout\": 300, \n \"activate_after\": 600\n },\n \"bot_detection\": {\n \"using_participant_events\": {\n \"timeout\": 600, \n \"activate_after\": 1200\n }\n },\n \"waiting_room_timeout\": 600,\n \"noone_joined_timeout\": 600,\n \"everyone_left_timeout\": 2,\n \"in_call_not_recording_timeout\": 600,\n \"recording_permission_denied_timeout\": 600\n}\n}",
|
||||
"sendBody": true,
|
||||
"specifyBody": "json",
|
||||
"authentication": "genericCredentialType",
|
||||
"genericAuthType": "httpHeaderAuth"
|
||||
},
|
||||
"credentials": {
|
||||
"httpHeaderAuth": {
|
||||
"id": "lfHu7Kn7L7SH3LAF",
|
||||
"name": "Recall"
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.2
|
||||
},
|
||||
{
|
||||
"id": "e1122b5b-3af5-4836-802c-40c3a0eb3c93",
|
||||
"name": "Create OpenAI thread",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
140,
|
||||
-980
|
||||
],
|
||||
"parameters": {
|
||||
"url": "https://api.openai.com/v1/threads",
|
||||
"method": "POST",
|
||||
"options": {},
|
||||
"sendHeaders": true,
|
||||
"authentication": "predefinedCredentialType",
|
||||
"headerParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "OpenAI-Beta",
|
||||
"value": "assistants=v2"
|
||||
}
|
||||
]
|
||||
},
|
||||
"nodeCredentialType": "openAiApi"
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "SphXAX7rlwRLkiox",
|
||||
"name": "Test club key"
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.2
|
||||
},
|
||||
{
|
||||
"id": "784c123d-adbb-4265-9485-2c88dd3091c2",
|
||||
"name": "Create data record",
|
||||
"type": "n8n-nodes-base.supabase",
|
||||
"position": [
|
||||
320,
|
||||
-980
|
||||
],
|
||||
"parameters": {
|
||||
"tableId": "data",
|
||||
"fieldsUi": {
|
||||
"fieldValues": [
|
||||
{
|
||||
"fieldId": "input",
|
||||
"fieldValue": "={{ {\"openai_thread_id\": $('Create OpenAI thread').item.json.id, \"recall_bot_id\": $('Create Recall bot').item.json.id, \"meeting_url\":$('Webhook').item.json.body.meeting_url } }}"
|
||||
},
|
||||
{
|
||||
"fieldId": "output",
|
||||
"fieldValue": "={{ {\"dialog\":[]} }}"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"supabaseApi": {
|
||||
"id": "iVKNf5qv3ZFhq0ZV",
|
||||
"name": "Supabase 5minAI"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "f455c7de-1e64-4a28-9eef-11d19c982813",
|
||||
"name": "Sticky Note9",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-900,
|
||||
-380
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 330.5152611046425,
|
||||
"height": 239.5888196628349,
|
||||
"content": "### ... or watch set up video [10 min]\n[](https://www.youtube.com/watch?v=rtaX6BMiTeo)\n"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "ea90c110-18ad-4f4b-90ab-fcb88b92e709",
|
||||
"name": "Sticky Note7",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-1200,
|
||||
-1060
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 636,
|
||||
"height": 657,
|
||||
"content": "\n## AI Agent for realtime insights on meetings\n**Made by [Mark Shcherbakov](https://www.linkedin.com/in/marklowcoding/) from community [5minAI](https://www.skool.com/5minai)**\n\nTranscribing meetings manually can be tedious and prone to error. This workflow automates the transcription process in real-time, ensuring that key discussions and decisions are accurately captured and easily accessible for later review, thus enhancing productivity and clarity in communications.\n\nThe workflow employs an AI-powered assistant to join virtual meetings and capture discussions through real-time transcription. Key functionalities include:\n- Automatic joining of meetings on platforms like Zoom, Google Meet, and others with the ability to provide real-time transcription.\n- Integration with transcription APIs (e.g., AssemblyAI) to deliver seamless and accurate capture of dialogue.\n- Structuring and storing transcriptions efficiently in a database for easy retrieval and analysis.\n\n1. **Real-Time Transcription**: The assistant captures audio during meetings and transcribes it in real-time, allowing participants to focus on discussions.\n2. **Keyword Recognition**: Key phrases can trigger specific actions, such as noting important points or making prompts to the assistant.\n3. **Structured Data Management**: The assistant maintains a database of transcriptions linked to meeting details for organized storage and quick access later."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "378c19bb-0e4a-43d3-9ba5-2a77ebfb5b83",
|
||||
"name": "Sticky Note6",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-1200,
|
||||
-380
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 280,
|
||||
"height": 626,
|
||||
"content": "### Set up steps\n\n#### Preparation\n\n1. **Create Recall.ai API key**\n2. **Setup Supabase account and table**\n```\ncreate table\n public.data (\n id uuid not null default gen_random_uuid (),\n date_created timestamp with time zone not null default (now() at time zone 'utc'::text),\n input jsonb null,\n output jsonb null,\n constraint data_pkey primary key (id),\n ) tablespace pg_default;\n\n```\n3. **Create OpenAI API key**\n\n#### Development\n\n1. **Bot Creation**: \n - Use a node to create the bot that will join meetings. Provide the meeting URL and set transcription options within the API request.\n\n2. **Authentication**: \n - Configure authentication settings via a Bearer token for interacting with your transcription service.\n\n3. **Webhook Setup**: \n - Create a webhook to receive real-time transcription updates, ensuring timely data capture during meetings.\n\n4. **Join Meeting**: \n - Set the bot to join the specified meeting and actively listen to capture conversations.\n\n5. **Transcription Handling**: \n - Combine transcription fragments into cohesive sentences and manage dialog arrays for coherence.\n\n6. **Trigger Actions on Keywords**: \n - Set up keyword recognition that can initiate requests to the OpenAI API for additional interactions based on captured dialogue.\n\n7. **Output and Summary Generation**: \n - Produce insights and summary notes from the transcriptions that can be stored back into the database for future reference."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "9a4ff741-ccfd-42e9-883e-43297a73e2c3",
|
||||
"name": "Scenario 1 Start - Edit Fields",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
-260,
|
||||
-980
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "4891fa6e-2dd5-4433-925c-5497ec82e8ab",
|
||||
"name": "meeting_url",
|
||||
"type": "string",
|
||||
"value": "https://meet.google.com/iix-vrav-kuc"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 3.4
|
||||
},
|
||||
{
|
||||
"id": "a4368763-b96e-45e7-884d-aa0cbae2d276",
|
||||
"name": "Scenario 2 Start - Webhook",
|
||||
"type": "n8n-nodes-base.webhook",
|
||||
"position": [
|
||||
-320,
|
||||
-300
|
||||
],
|
||||
"webhookId": "7f176935-cb83-4147-ac14-48c8d747863a",
|
||||
"parameters": {
|
||||
"path": "d074ca1e-52f9-47af-8587-8c24d431f9cd",
|
||||
"options": {},
|
||||
"httpMethod": "POST"
|
||||
},
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "107b26af-d1d2-40c7-ad4f-7193d3ae9b70",
|
||||
"name": "If Jimmy word",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"position": [
|
||||
80,
|
||||
-300
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"conditions": {
|
||||
"options": {
|
||||
"version": 2,
|
||||
"leftValue": "",
|
||||
"caseSensitive": true,
|
||||
"typeValidation": "strict"
|
||||
},
|
||||
"combinator": "and",
|
||||
"conditions": [
|
||||
{
|
||||
"id": "ba6c2ae5-d0f4-4242-9cf8-97cb84335a93",
|
||||
"operator": {
|
||||
"type": "string",
|
||||
"operation": "contains"
|
||||
},
|
||||
"leftValue": "={{ $('Scenario 2 Start - Webhook').item.json.body.data.transcript.words.map(word => word.text.replace(/'/g, \"''\")).join(\" \") }}",
|
||||
"rightValue": "=Jimmy"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.2
|
||||
},
|
||||
{
|
||||
"id": "49cf34f6-86cf-42cc-9da4-3efb37e6f565",
|
||||
"name": "Sticky Note",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-380,
|
||||
-1040
|
||||
],
|
||||
"parameters": {
|
||||
"width": 920,
|
||||
"height": 400,
|
||||
"content": "## Scenario 1\n\n"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "34660f39-6ecc-4f2d-98e8-a2c529255e98",
|
||||
"name": "Sticky Note1",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-380,
|
||||
-360
|
||||
],
|
||||
"parameters": {
|
||||
"width": 1020,
|
||||
"height": 420,
|
||||
"content": "## Scenario 2\n\n"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "5027e72d-2b2c-40b4-921e-c4f40d85f251",
|
||||
"name": "Sticky Note2",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-200,
|
||||
-120
|
||||
],
|
||||
"parameters": {
|
||||
"color": 3,
|
||||
"width": 270,
|
||||
"height": 80,
|
||||
"content": "### Replace Supabase credentials"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "dddea341-da40-4b6a-ae25-a8417e869cc9",
|
||||
"name": "Sticky Note3",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-100,
|
||||
-780
|
||||
],
|
||||
"parameters": {
|
||||
"color": 3,
|
||||
"width": 200,
|
||||
"height": 80,
|
||||
"content": "### Replace server location\n\n"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "e8e76c2a-f949-400e-92b2-39da8034b471",
|
||||
"name": "Sticky Note4",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
340,
|
||||
-100
|
||||
],
|
||||
"parameters": {
|
||||
"color": 4,
|
||||
"width": 270,
|
||||
"height": 80,
|
||||
"content": "### Replace OpenAI credentials"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "729a5f6e-5aea-4908-9a82-2a7d7bea1322",
|
||||
"name": "Sticky Note5",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
140,
|
||||
-780
|
||||
],
|
||||
"parameters": {
|
||||
"color": 3,
|
||||
"width": 290,
|
||||
"height": 80,
|
||||
"content": "### Replace credentials"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "31178e90-62ce-4bf8-8381-dc8138088889",
|
||||
"name": "Sticky Note8",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-320,
|
||||
-780
|
||||
],
|
||||
"parameters": {
|
||||
"color": 3,
|
||||
"width": 200,
|
||||
"height": 80,
|
||||
"content": "### Replace meeting url\n\n"
|
||||
},
|
||||
"typeVersion": 1
|
||||
}
|
||||
],
|
||||
"pinData": {
|
||||
"Create Recall bot": [
|
||||
{
|
||||
"id": "ab35fa56-e42b-47c6-b716-eac8d12af601",
|
||||
"join_at": null,
|
||||
"metadata": {},
|
||||
"recording": null,
|
||||
"video_url": null,
|
||||
"recordings": [],
|
||||
"meeting_url": {
|
||||
"platform": "google_meet",
|
||||
"meeting_id": "zst-ymag-zoa"
|
||||
},
|
||||
"status_changes": [
|
||||
{
|
||||
"code": "ready",
|
||||
"message": null,
|
||||
"sub_code": null,
|
||||
"created_at": "2024-11-01T11:29:32.364684Z"
|
||||
}
|
||||
],
|
||||
"meeting_metadata": null,
|
||||
"calendar_meetings": [],
|
||||
"meeting_participants": []
|
||||
}
|
||||
],
|
||||
"Insert Transcription Part": [
|
||||
{
|
||||
"dialog": "[{\"order\": 1, \"words\": \"Wait.\", \"speaker\": \"Mark S.\", \"language\": null, \"speaker_id\": 100}, {\"order\": 2, \"words\": \"A bit.\", \"speaker\": \"Mark S.\", \"language\": null, \"speaker_id\": 100}, {\"order\": 3, \"words\": \"It's not even subtitles and it's not even a real. It's. A Google Meet.\", \"speaker\": \"Mark S.\", \"language\": null, \"speaker_id\": 100}, {\"order\": 4, \"words\": \"Same story. I wasn't prepared. I don't know what to tell you. Maybe my AI body can help me.\", \"speaker\": \"Mark S.\", \"language\": null, \"speaker_id\": 100}, {\"order\": 5, \"words\": \"What truth?\", \"speaker\": \"Mark S.\", \"language\": null, \"speaker_id\": 100}, {\"order\": 6, \"words\": \"You can get the same AI body in one day. Just drop AI in comment and I will. Send you a guide.\", \"speaker\": \"Mark S.\", \"language\": null, \"speaker_id\": 100}, {\"order\": 7, \"words\": \"As it works well.\", \"speaker\": \"Mark S.\", \"language\": \"null\", \"speaker_id\": 100}, {\"order\": 8, \"words\": \"As it works well.\", \"speaker\": \"Mark S.\", \"language\": \"null\", \"speaker_id\": 100}, {\"order\": 9, \"words\": \"As it works well.\", \"speaker\": \"Mark S.\", \"language\": \"null\", \"speaker_id\": 100}, {\"order\": 10, \"words\": \"Let's it works well.\", \"speaker\": \"Mark S.\", \"language\": \"null\", \"speaker_id\": 100}, {\"order\": 11, \"words\": \"Let's it works well.\", \"speaker\": \"Mark S.\", \"language\": \"null\", \"speaker_id\": 100}, {\"order\": 12, \"words\": \"Let's it works well.\", \"speaker\": \"Mark S.\", \"language\": \"null\", \"speaker_id\": 100, \"date_updated\": \"2024-11-22T08:41:24.164+01:00\"}, {\"order\": 13, \"words\": \"Let's it works well.\", \"speaker\": \"Mark S.\", \"language\": \"null\", \"speaker_id\": 100, \"date_updated\": \"2024-11-22T08:50:11.330+01:00\"}]",
|
||||
"thread_id": "thread_0g7p3iE7MYmDPiUuPiZP5vfR",
|
||||
"date_updated": "2024-11-22T08:37:55.751+01:00"
|
||||
}
|
||||
],
|
||||
"Scenario 2 Start - Webhook": [
|
||||
{
|
||||
"body": {
|
||||
"data": {
|
||||
"bot_id": "0032c6e2-78e9-46e7-a2ef-41d7b853ef48",
|
||||
"transcript": {
|
||||
"words": [
|
||||
{
|
||||
"text": "Let's",
|
||||
"end_time": 11.88,
|
||||
"start_time": 11.68
|
||||
},
|
||||
{
|
||||
"text": "it",
|
||||
"end_time": 12.12,
|
||||
"start_time": 11.88
|
||||
},
|
||||
{
|
||||
"text": "works",
|
||||
"end_time": 12.44,
|
||||
"start_time": 12.12
|
||||
},
|
||||
{
|
||||
"text": "well.",
|
||||
"end_time": 12.48,
|
||||
"start_time": 12.44
|
||||
}
|
||||
],
|
||||
"source": "smart_annotator",
|
||||
"speaker": "Mark S.",
|
||||
"is_final": true,
|
||||
"language": null,
|
||||
"speaker_id": 100,
|
||||
"original_transcript_id": 32
|
||||
},
|
||||
"recording_id": "ee1ad589-39fe-4ed5-b96f-cd14c63f3bc2"
|
||||
},
|
||||
"event": "bot.transcription"
|
||||
},
|
||||
"query": {},
|
||||
"params": {},
|
||||
"headers": {
|
||||
"host": "n8n.lowcoding.dev",
|
||||
"accept": "*/*",
|
||||
"content-type": "application/json",
|
||||
"content-length": "495",
|
||||
"accept-encoding": "gzip",
|
||||
"x-forwarded-for": "52.10.191.34",
|
||||
"x-forwarded-host": "n8n.lowcoding.dev",
|
||||
"x-forwarded-proto": "https"
|
||||
},
|
||||
"webhookUrl": "https://n8n.lowcoding.dev/webhook/d074ca1e-52f9-47af-8587-8c24d431f9cd",
|
||||
"executionMode": "production"
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"OpenAI1": {
|
||||
"main": [
|
||||
[]
|
||||
]
|
||||
},
|
||||
"Create Note": {
|
||||
"ai_tool": [
|
||||
[
|
||||
{
|
||||
"node": "OpenAI1",
|
||||
"type": "ai_tool",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"If Jimmy word": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "OpenAI1",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Create Recall bot": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Create OpenAI thread",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[]
|
||||
]
|
||||
},
|
||||
"Create data record": {
|
||||
"main": [
|
||||
[]
|
||||
]
|
||||
},
|
||||
"Create OpenAI thread": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Create data record",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Insert Transcription Part": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "If Jimmy word",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Scenario 2 Start - Webhook": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Insert Transcription Part",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Scenario 1 Start - Edit Fields": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Create Recall bot",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,258 @@
|
||||
{
|
||||
"id": "6",
|
||||
"name": "ETL pipeline",
|
||||
"nodes": [
|
||||
{
|
||||
"name": "Twitter",
|
||||
"type": "n8n-nodes-base.twitter",
|
||||
"position": [
|
||||
300,
|
||||
300
|
||||
],
|
||||
"parameters": {
|
||||
"limit": 3,
|
||||
"operation": "search",
|
||||
"searchText": "=#OnThisDay",
|
||||
"additionalFields": {}
|
||||
},
|
||||
"credentials": {
|
||||
"twitterOAuth1Api": "twitter_api"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "Postgres",
|
||||
"type": "n8n-nodes-base.postgres",
|
||||
"position": [
|
||||
1100,
|
||||
300
|
||||
],
|
||||
"parameters": {
|
||||
"table": "tweets",
|
||||
"columns": "text, score, magnitude",
|
||||
"returnFields": "=*"
|
||||
},
|
||||
"credentials": {
|
||||
"postgres": "postgres"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "MongoDB",
|
||||
"type": "n8n-nodes-base.mongoDb",
|
||||
"position": [
|
||||
500,
|
||||
300
|
||||
],
|
||||
"parameters": {
|
||||
"fields": "text",
|
||||
"options": {},
|
||||
"operation": "insert",
|
||||
"collection": "tweets"
|
||||
},
|
||||
"credentials": {
|
||||
"mongoDb": "mongodb"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "Slack",
|
||||
"type": "n8n-nodes-base.slack",
|
||||
"position": [
|
||||
1500,
|
||||
200
|
||||
],
|
||||
"parameters": {
|
||||
"text": "=\ud83d\udc26 NEW TWEET with sentiment score {{$json[\"score\"]}} and magnitude {{$json[\"magnitude\"]}} \u2b07\ufe0f\n{{$json[\"text\"]}}",
|
||||
"channel": "tweets",
|
||||
"attachments": [],
|
||||
"otherOptions": {}
|
||||
},
|
||||
"credentials": {
|
||||
"slackApi": "slack"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "IF",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"position": [
|
||||
1300,
|
||||
300
|
||||
],
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"number": [
|
||||
{
|
||||
"value1": "={{$json[\"score\"]}}",
|
||||
"operation": "larger"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "NoOp",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"position": [
|
||||
1500,
|
||||
400
|
||||
],
|
||||
"parameters": {},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "Google Cloud Natural Language",
|
||||
"type": "n8n-nodes-base.googleCloudNaturalLanguage",
|
||||
"position": [
|
||||
700,
|
||||
300
|
||||
],
|
||||
"parameters": {
|
||||
"content": "={{$node[\"MongoDB\"].json[\"text\"]}}",
|
||||
"options": {}
|
||||
},
|
||||
"credentials": {
|
||||
"googleCloudNaturalLanguageOAuth2Api": "google_nlp"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "Set",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
900,
|
||||
300
|
||||
],
|
||||
"parameters": {
|
||||
"values": {
|
||||
"number": [
|
||||
{
|
||||
"name": "score",
|
||||
"value": "={{$json[\"documentSentiment\"][\"score\"]}}"
|
||||
},
|
||||
{
|
||||
"name": "magnitude",
|
||||
"value": "={{$json[\"documentSentiment\"][\"magnitude\"]}}"
|
||||
}
|
||||
],
|
||||
"string": [
|
||||
{
|
||||
"name": "text",
|
||||
"value": "={{$node[\"Twitter\"].json[\"text\"]}}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "Cron",
|
||||
"type": "n8n-nodes-base.cron",
|
||||
"position": [
|
||||
100,
|
||||
300
|
||||
],
|
||||
"parameters": {
|
||||
"triggerTimes": {
|
||||
"item": [
|
||||
{
|
||||
"hour": 6
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
}
|
||||
],
|
||||
"active": false,
|
||||
"settings": {},
|
||||
"connections": {
|
||||
"IF": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Slack",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "NoOp",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Set": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Postgres",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Cron": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Twitter",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"MongoDB": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Google Cloud Natural Language",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Twitter": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "MongoDB",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Postgres": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "IF",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Google Cloud Natural Language": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Set",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
1743
workflows/Postgres/1752_Postgres_Wordpress_Automation_Webhook.json
Normal file
1743
workflows/Postgres/1752_Postgres_Wordpress_Automation_Webhook.json
Normal file
File diff suppressed because it is too large
Load Diff
671
workflows/Postgres/1788_Postgres_Code_Automation_Webhook.json
Normal file
671
workflows/Postgres/1788_Postgres_Code_Automation_Webhook.json
Normal file
@@ -0,0 +1,671 @@
|
||||
{
|
||||
"id": "Zrd98BnbmN1Px9an",
|
||||
"meta": {
|
||||
"instanceId": "edc0464b1050024ebda3e16fceea795e4fdf67b1f61187c4f2f3a72397278df0",
|
||||
"templateCredsSetupCompleted": true
|
||||
},
|
||||
"name": "Youtube Searcher",
|
||||
"tags": [],
|
||||
"nodes": [
|
||||
{
|
||||
"id": "5cb8757a-d8f0-49fa-803d-7f04b514f9f8",
|
||||
"name": "Loop Over Items",
|
||||
"type": "n8n-nodes-base.splitInBatches",
|
||||
"position": [
|
||||
80,
|
||||
220
|
||||
],
|
||||
"parameters": {
|
||||
"options": {}
|
||||
},
|
||||
"typeVersion": 3
|
||||
},
|
||||
{
|
||||
"id": "28964bd5-dc53-4dfa-bbb1-4eb80b952063",
|
||||
"name": "find_video_data1",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
1440,
|
||||
320
|
||||
],
|
||||
"parameters": {
|
||||
"url": "https://www.googleapis.com/youtube/v3/videos?",
|
||||
"options": {},
|
||||
"sendQuery": true,
|
||||
"queryParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "key",
|
||||
"value": "={{ $env[\"GOOGLE_API_KEY\"] }}"
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"value": "={{ $json.id.videoId }}"
|
||||
},
|
||||
{
|
||||
"name": "part",
|
||||
"value": "contentDetails, statistics"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.2
|
||||
},
|
||||
{
|
||||
"id": "5e8b9441-4b91-4460-a9ac-4a0a02aa57ad",
|
||||
"name": "When clicking ‘Test workflow’",
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"disabled": true,
|
||||
"position": [
|
||||
-180,
|
||||
220
|
||||
],
|
||||
"parameters": {},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "793ef651-ea56-41bc-a0a9-feeaddf999c0",
|
||||
"name": "Execute Workflow Trigger",
|
||||
"type": "n8n-nodes-base.executeWorkflowTrigger",
|
||||
"position": [
|
||||
-160,
|
||||
-180
|
||||
],
|
||||
"parameters": {},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "64e331ff-2cda-4ba0-94f9-03fa6c3d6590",
|
||||
"name": "fetch_last_registered",
|
||||
"type": "n8n-nodes-base.postgres",
|
||||
"position": [
|
||||
360,
|
||||
360
|
||||
],
|
||||
"parameters": {
|
||||
"query": "SELECT MAX(publish_time) AS latest_publish_time\nFROM video_statistics\nWHERE channel_id = '{{ $json.id }}';",
|
||||
"options": {},
|
||||
"operation": "executeQuery"
|
||||
},
|
||||
"credentials": {
|
||||
"postgres": {
|
||||
"id": "KQiQIZTArTBSNJH7",
|
||||
"name": "Postgres account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.5
|
||||
},
|
||||
{
|
||||
"id": "fb0a8208-c920-4344-8816-ef6509f07abc",
|
||||
"name": "get_videos",
|
||||
"type": "n8n-nodes-base.youTube",
|
||||
"onError": "continueRegularOutput",
|
||||
"position": [
|
||||
640,
|
||||
360
|
||||
],
|
||||
"parameters": {
|
||||
"limit": 50,
|
||||
"filters": {
|
||||
"channelId": "={{ $('Loop Over Items').item.json.id }}",
|
||||
"regionCode": "US",
|
||||
"publishedAfter": "={{ $json.latest_publish_time ? new Date(new Date($json.latest_publish_time).getTime() + 60 * 60 * 1000).toISOString() : new Date(Date.now() - 3 * 30 * 24 * 60 * 60 * 1000).toISOString() }}"
|
||||
},
|
||||
"options": {
|
||||
"order": "relevance",
|
||||
"safeSearch": "moderate"
|
||||
},
|
||||
"resource": "video"
|
||||
},
|
||||
"credentials": {
|
||||
"youTubeOAuth2Api": {
|
||||
"id": "o3VUdoHEk6VhB1lq",
|
||||
"name": "YouTube account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1,
|
||||
"alwaysOutputData": true
|
||||
},
|
||||
{
|
||||
"id": "ea358d3c-9a83-49c9-a02e-745cf5b29097",
|
||||
"name": "if_is_empty",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"onError": "continueRegularOutput",
|
||||
"position": [
|
||||
940,
|
||||
540
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"conditions": {
|
||||
"options": {
|
||||
"version": 2,
|
||||
"leftValue": "",
|
||||
"caseSensitive": true,
|
||||
"typeValidation": "strict"
|
||||
},
|
||||
"combinator": "or",
|
||||
"conditions": [
|
||||
{
|
||||
"id": "7591deae-4626-4b2e-af26-d02042573a13",
|
||||
"operator": {
|
||||
"type": "object",
|
||||
"operation": "notEmpty",
|
||||
"singleValue": true
|
||||
},
|
||||
"leftValue": "={{ $input.item.json }}",
|
||||
"rightValue": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.2
|
||||
},
|
||||
{
|
||||
"id": "142e5c5e-f488-4667-a759-ef4494f2a194",
|
||||
"name": "Postgres",
|
||||
"type": "n8n-nodes-base.postgres",
|
||||
"position": [
|
||||
80,
|
||||
-180
|
||||
],
|
||||
"parameters": {
|
||||
"query": "WITH RankedVideos AS (\n SELECT \n channel_id,\n id,\n view_count,\n like_count,\n comment_count,\n publish_time,\n ROW_NUMBER() OVER (PARTITION BY channel_id ORDER BY view_count DESC) AS rank_desc,\n ROW_NUMBER() OVER (PARTITION BY channel_id ORDER BY view_count ASC) AS rank_asc\n FROM video_statistics\n),\nFilteredVideos AS (\n SELECT \n channel_id,\n id,\n view_count,\n like_count,\n comment_count,\n publish_time\n FROM RankedVideos\n WHERE NOT (\n rank_desc <= 2 OR rank_asc <= 2 -- Exclude top 2 and bottom 2 videos\n )\n OR (\n (SELECT COUNT(*) FROM video_statistics WHERE video_statistics.channel_id = RankedVideos.channel_id) <= 10 -- Include all videos if 10 or fewer exist\n )\n),\nChannelStats AS (\n SELECT \n channel_id,\n ROUND(AVG(view_count)::NUMERIC, 0) AS average_views -- Round to 0 decimal places\n FROM FilteredVideos\n GROUP BY channel_id\n)\nSELECT \n v.channel_id,\n c.average_views,\n JSON_AGG(\n JSON_BUILD_OBJECT(\n 'id', v.id,\n 'view_count', v.view_count,\n 'like_count', v.like_count,\n 'comment_count', v.comment_count,\n 'publish_time', v.publish_time\n )\n ) AS channel_videos\nFROM video_statistics v\nLEFT JOIN ChannelStats c\nON v.channel_id = c.channel_id\nGROUP BY v.channel_id, c.average_views;\n",
|
||||
"options": {},
|
||||
"operation": "executeQuery"
|
||||
},
|
||||
"credentials": {
|
||||
"postgres": {
|
||||
"id": "KQiQIZTArTBSNJH7",
|
||||
"name": "Postgres account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.5
|
||||
},
|
||||
{
|
||||
"id": "a542b55e-bab4-476d-8333-692f5b3a5dcb",
|
||||
"name": "insert_items",
|
||||
"type": "n8n-nodes-base.postgres",
|
||||
"position": [
|
||||
2980,
|
||||
320
|
||||
],
|
||||
"parameters": {
|
||||
"query": "{{$json.query}}",
|
||||
"options": {
|
||||
"queryReplacement": "={{$json.parameters}}"
|
||||
},
|
||||
"operation": "executeQuery"
|
||||
},
|
||||
"credentials": {
|
||||
"postgres": {
|
||||
"id": "KQiQIZTArTBSNJH7",
|
||||
"name": "Postgres account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.5
|
||||
},
|
||||
{
|
||||
"id": "6680728a-805e-4a45-8720-56726ad9e582",
|
||||
"name": "create_table",
|
||||
"type": "n8n-nodes-base.postgres",
|
||||
"position": [
|
||||
620,
|
||||
-180
|
||||
],
|
||||
"parameters": {
|
||||
"query": "CREATE TABLE video_statistics (\n id VARCHAR(255) PRIMARY KEY, -- Unique identifier for the video\n view_count INT NOT NULL, -- Number of views\n like_count INT NOT NULL, -- Number of likes\n comment_count INT NOT NULL, -- Number of comments\n publish_time TIMESTAMP NOT NULL, -- Timestamp of publishing\n channel_id VARCHAR(255) NOT NULL -- Channel ID\n);\n",
|
||||
"options": {},
|
||||
"operation": "executeQuery"
|
||||
},
|
||||
"credentials": {
|
||||
"postgres": {
|
||||
"id": "KQiQIZTArTBSNJH7",
|
||||
"name": "Postgres account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.5
|
||||
},
|
||||
{
|
||||
"id": "4e345df5-bdd6-4a93-9096-367bd911dbd4",
|
||||
"name": "remove_shorts",
|
||||
"type": "n8n-nodes-base.code",
|
||||
"position": [
|
||||
1720,
|
||||
320
|
||||
],
|
||||
"parameters": {
|
||||
"jsCode": "const input = $input.all();\n\nconst iso8601ToSeconds = iso8601 => {\n const match = iso8601 ? iso8601.match(/PT(?:(\\d+)H)?(?:(\\d+)M)?(?:(\\d+)S)?/) : null;\n if (!match) {\n console.warn(`Invalid ISO8601 duration: ${iso8601}`);\n return 0; \n }\n const hours = parseInt(match[1] || 0, 10);\n const minutes = parseInt(match[2] || 0, 10);\n const seconds = parseInt(match[3] || 0, 10);\n return hours * 3600 + minutes * 60 + seconds;\n};\n\nconst filteredResponses = input.filter(response => {\n if (response.json && response.json.items) {\n const validItems = response.json.items.filter(item => {\n const duration = item.contentDetails?.duration;\n if (!duration) {\n console.warn(`Missing duration for item: ${JSON.stringify(item)}`);\n return false; \n }\n const durationInSeconds = iso8601ToSeconds(duration);\n\n return durationInSeconds > 210;\n });\n\n response.json.items = validItems;\n\n return validItems.length > 0; \n }\n\n return false;\n});\n\nreturn filteredResponses;\n"
|
||||
},
|
||||
"typeVersion": 2,
|
||||
"alwaysOutputData": true
|
||||
},
|
||||
{
|
||||
"id": "aadac7e3-8114-4c43-b0bf-d1a7de7c3e0c",
|
||||
"name": "create_query",
|
||||
"type": "n8n-nodes-base.code",
|
||||
"position": [
|
||||
2780,
|
||||
320
|
||||
],
|
||||
"parameters": {
|
||||
"jsCode": "const input = $input.all();\n\nlet tableName = \"video_statistics\"; \n\nconst rows = input;\n\nconst formattedRows = rows.map(elements => {\n const row = elements.json;\n const formattedRow = {\n id: row.id,\n view_count: parseInt(row.viewCount, 10) || 0, \n like_count: parseInt(row.likeCount, 10) || 0,\n comment_count: parseInt(row.commentCount, 10) || 0,\n publish_time: row.publishTime ? new Date(row.publishTime).toISOString() : null,\n channel_id: $('Loop Over Items').first().json.id || \"unknown\"\n };\n return formattedRow;\n});\n\nconst columns = [\"id\", \"view_count\", \"like_count\", \"comment_count\", \"publish_time\", \"channel_id\"];\n\nconst valuePlaceholders = formattedRows.map((_, rowIndex) =>\n `(${columns.map((_, colIndex) => `$${rowIndex * columns.length + colIndex + 1}`).join(\", \")})`\n).join(\", \");\n\nconst insertQuery = `INSERT INTO ${tableName} (${columns.map(col => `\\\"${col}\\\"`).join(\", \")}) VALUES ${valuePlaceholders};`;\n\nconst parameters = formattedRows.flatMap(row => \n columns.map(col => row[col])\n);\n\nreturn [\n {\n query: insertQuery,\n parameters: parameters\n }\n];\n"
|
||||
},
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "46376f7c-1ce1-4f8a-8392-7281aacfd1c5",
|
||||
"name": "structure_data",
|
||||
"type": "n8n-nodes-base.code",
|
||||
"position": [
|
||||
2560,
|
||||
320
|
||||
],
|
||||
"parameters": {
|
||||
"jsCode": "const input = $input.all(); \n\nconst filteredInput = input.filter(item => item.json.viewCount !== null);\n\nconst updatedInput = filteredInput.map(item => {\n return {\n ...item,\n json: {\n ...item.json,\n likeCount: item.json.likeCount === null ? \"0\" : item.json.likeCount,\n commentCount: item.json.commentCount === null ? \"0\" : item.json.commentCount\n }\n };\n});\n\nreturn updatedInput;\n"
|
||||
},
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "f66597ef-1324-45e0-b3e8-bc8a588315e4",
|
||||
"name": "if_empty",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"position": [
|
||||
2020,
|
||||
500
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"conditions": {
|
||||
"options": {
|
||||
"version": 2,
|
||||
"leftValue": "",
|
||||
"caseSensitive": true,
|
||||
"typeValidation": "strict"
|
||||
},
|
||||
"combinator": "and",
|
||||
"conditions": [
|
||||
{
|
||||
"id": "dacc5370-f54c-4b90-a2aa-65efff196d3b",
|
||||
"operator": {
|
||||
"type": "object",
|
||||
"operation": "notEmpty",
|
||||
"singleValue": true
|
||||
},
|
||||
"leftValue": "={{ $json }}",
|
||||
"rightValue": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.2
|
||||
},
|
||||
{
|
||||
"id": "1176b08f-79bb-4f8f-8c83-25a7c2cee9e7",
|
||||
"name": "already_populated",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
1200,
|
||||
600
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "7579fbc3-d702-4c36-b539-11b7db6c07fa",
|
||||
"name": "report",
|
||||
"type": "string",
|
||||
"value": "={{ $('Loop Over Items').item.json.url }} already populated. Latest was: {{ $('fetch_last_registered').item.json.latest_publish_time }}"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 3.4
|
||||
},
|
||||
{
|
||||
"id": "265b3062-ee60-4de0-8ee0-3973e653aa7d",
|
||||
"name": "map_data",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
2340,
|
||||
320
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "1a76e4e8-cd56-4d55-bcbf-ed24708e1464",
|
||||
"name": "id",
|
||||
"type": "string",
|
||||
"value": "={{ $json.items[0].id }}"
|
||||
},
|
||||
{
|
||||
"id": "0b6d93ba-89fb-4781-809f-6c7bd887f9e2",
|
||||
"name": "viewCount",
|
||||
"type": "string",
|
||||
"value": "={{ $json.items[0].statistics.viewCount }}"
|
||||
},
|
||||
{
|
||||
"id": "9526b059-661a-49a2-81d3-3623d677ddd1",
|
||||
"name": "likeCount",
|
||||
"type": "string",
|
||||
"value": "={{ $json.items[0].statistics.likeCount }}"
|
||||
},
|
||||
{
|
||||
"id": "ca4adf8b-d74f-4dda-a96e-0a2ca3e864e3",
|
||||
"name": "commentCount",
|
||||
"type": "string",
|
||||
"value": "={{ $json.items[0].statistics.commentCount }}"
|
||||
},
|
||||
{
|
||||
"id": "8129ff1c-87c6-489b-83f8-88bdbf426b0f",
|
||||
"name": "=publishTime",
|
||||
"type": "string",
|
||||
"value": "={{ $('get_videos').item.json.snippet.publishedAt }}"
|
||||
},
|
||||
{
|
||||
"id": "16fc88dc-4772-4380-873d-2aa9642b31ac",
|
||||
"name": "channelId",
|
||||
"type": "string",
|
||||
"value": "={{ $('if_is_empty').item.json.snippet.channelId }}"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 3.4
|
||||
},
|
||||
{
|
||||
"id": "173ac548-89be-4e94-a0e3-e90c45489a0c",
|
||||
"name": "sanitize_data",
|
||||
"type": "n8n-nodes-base.code",
|
||||
"position": [
|
||||
300,
|
||||
-180
|
||||
],
|
||||
"parameters": {
|
||||
"jsCode": "const now = new Date();\nconst twoWeeksAgo = new Date(now.getTime() - 14 * 24 * 60 * 60 * 1000);\n\nconst bestPerformingVideos = [];\n\n$input.all().forEach(channel => {\n \n const averageViews = parseInt(channel.json.average_views, 10);\n \n channel.json.channel_videos.forEach(video => {\n const publishDate = new Date(video.publish_time);\n const isWithinTwoWeeks = publishDate >= twoWeeksAgo && publishDate <= now;\n const isAboveThreshold = video.view_count >= 2 * averageViews;\n\n \n if (isWithinTwoWeeks && isAboveThreshold) {\n const score = (video.like_count / video.view_count) * 100;\n bestPerformingVideos.push({\n id: video.id,\n videoUrl: `https://www.youtube.com/watch?v=${video.id}`,\n viewCount: video.view_count,\n likeCount: video.like_count,\n score: parseFloat(score.toFixed(2)),\n commentCount: video.comment_count,\n channelId: `https://www.youtube.com/channel/${channel.json.channel_id}` \n });\n }\n });\n});\n\nreturn bestPerformingVideos;\n"
|
||||
},
|
||||
"typeVersion": 2,
|
||||
"alwaysOutputData": true
|
||||
},
|
||||
{
|
||||
"id": "48e729ac-985c-47f5-8895-d2e52581e849",
|
||||
"name": "Sticky Note",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-260,
|
||||
140
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 3440,
|
||||
"height": 720,
|
||||
"content": "### Save Videos To Database"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "11c51123-27f7-4de7-9215-49d89679c2f6",
|
||||
"name": "Sticky Note1",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-260,
|
||||
-260
|
||||
],
|
||||
"parameters": {
|
||||
"color": 6,
|
||||
"width": 780,
|
||||
"height": 280,
|
||||
"content": "### Fetch best performing videos from last 2 weeks"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "7ef37f94-9283-4b51-a127-98c94542429a",
|
||||
"name": "see table",
|
||||
"type": "n8n-nodes-base.postgres",
|
||||
"position": [
|
||||
920,
|
||||
-180
|
||||
],
|
||||
"parameters": {
|
||||
"query": "SELECT * FROM video_statistics;",
|
||||
"options": {},
|
||||
"operation": "executeQuery"
|
||||
},
|
||||
"credentials": {
|
||||
"postgres": {
|
||||
"id": "KQiQIZTArTBSNJH7",
|
||||
"name": "Postgres account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.5
|
||||
},
|
||||
{
|
||||
"id": "e66af542-ea16-4c3c-9f6e-b5401bbd41da",
|
||||
"name": "drop table",
|
||||
"type": "n8n-nodes-base.postgres",
|
||||
"position": [
|
||||
1200,
|
||||
-180
|
||||
],
|
||||
"parameters": {
|
||||
"query": "DROP TABLE video_statistics;",
|
||||
"options": {},
|
||||
"operation": "executeQuery"
|
||||
},
|
||||
"credentials": {
|
||||
"postgres": {
|
||||
"id": "KQiQIZTArTBSNJH7",
|
||||
"name": "Postgres account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.5
|
||||
}
|
||||
],
|
||||
"active": false,
|
||||
"pinData": {
|
||||
"When clicking ‘Test workflow’": [
|
||||
{
|
||||
"json": {
|
||||
"id": "UCMwVTLZIRRUyyVrkjDpn4pA",
|
||||
"url": "https://www.youtube.com/@ColeMedin"
|
||||
}
|
||||
},
|
||||
{
|
||||
"json": {
|
||||
"id": "UC2ojq-nuP8ceeHqiroeKhBA",
|
||||
"url": "www.youtube.com/@nateherk"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "8ee4a252-a795-4931-951f-024d1f0d801a",
|
||||
"connections": {
|
||||
"Postgres": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "sanitize_data",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"if_empty": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "map_data",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Loop Over Items",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"map_data": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "structure_data",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"get_videos": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "if_is_empty",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"if_is_empty": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "find_video_data1",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "already_populated",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"create_query": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "insert_items",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"insert_items": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Loop Over Items",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"remove_shorts": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "if_empty",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"structure_data": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "create_query",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Loop Over Items": {
|
||||
"main": [
|
||||
[],
|
||||
[
|
||||
{
|
||||
"node": "fetch_last_registered",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"find_video_data1": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "remove_shorts",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"already_populated": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Loop Over Items",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"fetch_last_registered": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "get_videos",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Execute Workflow Trigger": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Postgres",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"When clicking ‘Test workflow’": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Loop Over Items",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
1743
workflows/Postgres/1942_Postgres_Wordpress_Automation_Webhook.json
Normal file
1743
workflows/Postgres/1942_Postgres_Wordpress_Automation_Webhook.json
Normal file
File diff suppressed because it is too large
Load Diff
1228
workflows/Postgres/2014_Postgres_Webhook_Automation_Webhook.json
Normal file
1228
workflows/Postgres/2014_Postgres_Webhook_Automation_Webhook.json
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user