Advertisement
Guest User

Untitled

a guest
Jun 8th, 2025
639
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JSON 29.45 KB | None | 0 0
  1. {
  2.   "name": "News poster (ENGLISH)",
  3.   "nodes": [
  4.     {
  5.       "parameters": {
  6.         "method": "POST",
  7.         "url": "https://api.canva.com/rest/v1/exports",
  8.         "authentication": "genericCredentialType",
  9.         "genericAuthType": "oAuth2Api",
  10.         "sendBody": true,
  11.         "specifyBody": "json",
  12.         "jsonBody": "={\n  \"design_id\": \"{{ $('Design job done?').item.json.job.result.design.id }}\",\n  \"format\": {\n    \"type\": \"png\"\n  }\n}",
  13.         "options": {}
  14.       },
  15.       "type": "n8n-nodes-base.httpRequest",
  16.       "typeVersion": 4.2,
  17.       "position": [
  18.         440,
  19.         560
  20.       ],
  21.       "id": "49fb605f-a3c6-40d2-8bb8-5581e4d1839d",
  22.       "name": "Create export job",
  23.       "credentials": {
  24.         "oAuth2Api": {
  25.           "id": "bWv1B5JaqBFfkb9P",
  26.           "name": "Canva Oauth2"
  27.         }
  28.       }
  29.     },
  30.     {
  31.       "parameters": {
  32.         "conditions": {
  33.           "options": {
  34.             "caseSensitive": true,
  35.             "leftValue": "",
  36.             "typeValidation": "strict",
  37.             "version": 2
  38.           },
  39.           "conditions": [
  40.             {
  41.               "id": "aeadbb77-e6e5-402c-8578-d0a81cd01e0c",
  42.               "leftValue": "={{ $json.job.status }}",
  43.               "rightValue": "success",
  44.               "operator": {
  45.                 "type": "string",
  46.                 "operation": "equals"
  47.               }
  48.             }
  49.           ],
  50.           "combinator": "and"
  51.         },
  52.         "options": {}
  53.       },
  54.       "type": "n8n-nodes-base.if",
  55.       "typeVersion": 2.2,
  56.       "position": [
  57.         1100,
  58.         280
  59.       ],
  60.       "id": "1a91cd69-15e0-4cc2-b97c-07f66b8e136e",
  61.       "name": "Design job done?"
  62.     },
  63.     {
  64.       "parameters": {
  65.         "url": "=https://api.canva.com/rest/v1/autofills/{{ $('Create design job').item.json.job.id }}",
  66.         "authentication": "genericCredentialType",
  67.         "genericAuthType": "oAuth2Api",
  68.         "options": {}
  69.       },
  70.       "type": "n8n-nodes-base.httpRequest",
  71.       "typeVersion": 4.2,
  72.       "position": [
  73.         880,
  74.         280
  75.       ],
  76.       "id": "898ebfc9-7026-4525-aaf3-3520a3e3e118",
  77.       "name": "Get design job status",
  78.       "credentials": {
  79.         "oAuth2Api": {
  80.           "id": "bWv1B5JaqBFfkb9P",
  81.           "name": "Canva Oauth2"
  82.         }
  83.       }
  84.     },
  85.     {
  86.       "parameters": {
  87.         "url": "=https://api.canva.com/rest/v1/exports/{{ $json.job.id }}",
  88.         "authentication": "genericCredentialType",
  89.         "genericAuthType": "oAuth2Api",
  90.         "options": {}
  91.       },
  92.       "type": "n8n-nodes-base.httpRequest",
  93.       "typeVersion": 4.2,
  94.       "position": [
  95.         880,
  96.         560
  97.       ],
  98.       "id": "de83216c-fe2c-4159-b86a-7548d503af06",
  99.       "name": "Get export job status",
  100.       "credentials": {
  101.         "oAuth2Api": {
  102.           "id": "bWv1B5JaqBFfkb9P",
  103.           "name": "Canva Oauth2"
  104.         }
  105.       }
  106.     },
  107.     {
  108.       "parameters": {
  109.         "conditions": {
  110.           "options": {
  111.             "caseSensitive": true,
  112.             "leftValue": "",
  113.             "typeValidation": "strict",
  114.             "version": 2
  115.           },
  116.           "conditions": [
  117.             {
  118.               "id": "74fe206b-9d44-45ab-978c-a4c200d0cb0b",
  119.               "leftValue": "={{ $json.job.status }}",
  120.               "rightValue": "success",
  121.               "operator": {
  122.                 "type": "string",
  123.                 "operation": "equals",
  124.                 "name": "filter.operator.equals"
  125.               }
  126.             }
  127.           ],
  128.           "combinator": "and"
  129.         },
  130.         "options": {}
  131.       },
  132.       "type": "n8n-nodes-base.if",
  133.       "typeVersion": 2.2,
  134.       "position": [
  135.         1100,
  136.         560
  137.       ],
  138.       "id": "a90492d4-81cd-451b-8988-d638acd1c3b1",
  139.       "name": "Export job done?"
  140.     },
  141.     {
  142.       "parameters": {
  143.         "options": {}
  144.       },
  145.       "type": "n8n-nodes-base.splitInBatches",
  146.       "typeVersion": 3,
  147.       "position": [
  148.         -200,
  149.         100
  150.       ],
  151.       "id": "b49c6cc3-3cea-4697-a84d-b936f7663e55",
  152.       "name": "Loop Over Items"
  153.     },
  154.     {
  155.       "parameters": {
  156.         "jsCode": "const pages = $input.first().json.choices[0].message.content.pages;\nreturn pages.map(page => ({ json: page }))"
  157.       },
  158.       "type": "n8n-nodes-base.code",
  159.       "typeVersion": 2,
  160.       "position": [
  161.         -420,
  162.         100
  163.       ],
  164.       "id": "27812dc1-c1cf-48a8-ba46-122ef8ecb436",
  165.       "name": "Split out pages"
  166.     },
  167.     {
  168.       "parameters": {
  169.         "rules": {
  170.           "values": [
  171.             {
  172.               "conditions": {
  173.                 "options": {
  174.                   "caseSensitive": true,
  175.                   "leftValue": "",
  176.                   "typeValidation": "strict",
  177.                   "version": 2
  178.                 },
  179.                 "conditions": [
  180.                   {
  181.                     "leftValue": "={{ $json.type }}",
  182.                     "rightValue": "cover",
  183.                     "operator": {
  184.                       "type": "string",
  185.                       "operation": "equals"
  186.                     },
  187.                     "id": "dcd493ed-b2a6-49c6-a939-fd11c69b8dc0"
  188.                   }
  189.                 ],
  190.                 "combinator": "and"
  191.               },
  192.               "renameOutput": true,
  193.               "outputKey": "cover"
  194.             },
  195.             {
  196.               "conditions": {
  197.                 "options": {
  198.                   "caseSensitive": true,
  199.                   "leftValue": "",
  200.                   "typeValidation": "strict",
  201.                   "version": 2
  202.                 },
  203.                 "conditions": [
  204.                   {
  205.                     "id": "770f225e-dd12-420e-9930-bb90532d23e7",
  206.                     "leftValue": "={{ $json.type }}",
  207.                     "rightValue": "body",
  208.                     "operator": {
  209.                       "type": "string",
  210.                       "operation": "equals",
  211.                       "name": "filter.operator.equals"
  212.                     }
  213.                   }
  214.                 ],
  215.                 "combinator": "and"
  216.               },
  217.               "renameOutput": true,
  218.               "outputKey": "body"
  219.             }
  220.           ]
  221.         },
  222.         "options": {}
  223.       },
  224.       "type": "n8n-nodes-base.switch",
  225.       "typeVersion": 3.2,
  226.       "position": [
  227.         0,
  228.         280
  229.       ],
  230.       "id": "f41719a9-7381-40cd-8ca2-42c68f225b40",
  231.       "name": "Switch"
  232.     },
  233.     {
  234.       "parameters": {
  235.         "assignments": {
  236.           "assignments": [
  237.             {
  238.               "id": "5db73f6a-b945-4df3-8764-71d790b28442",
  239.               "name": "request_body",
  240.               "value": "={\n  \"brand_template_id\": \"{{ $('Set run variables').item.json.coverBrandTemplateId }}\",\n  \"data\": {\n    \"page_number\": {\n      \"type\": \"text\",\n      \"text\": \"{{ $json.page_number }}\"\n    },\n    \"title\": {\n      \"type\": \"text\",\n      \"text\": {{ JSON.stringify($json.title) }}\n    }\n  }\n}",
  241.               "type": "string"
  242.             }
  243.           ]
  244.         },
  245.         "options": {}
  246.       },
  247.       "type": "n8n-nodes-base.set",
  248.       "typeVersion": 3.4,
  249.       "position": [
  250.         220,
  251.         180
  252.       ],
  253.       "id": "1a68fe54-b755-48f2-ba7f-a613e84613dd",
  254.       "name": "Set cover fields"
  255.     },
  256.     {
  257.       "parameters": {
  258.         "assignments": {
  259.           "assignments": [
  260.             {
  261.               "id": "5db73f6a-b945-4df3-8764-71d790b28442",
  262.               "name": "request_body",
  263.               "value": "={\n  \"brand_template_id\": \"{{ $('Set run variables').item.json.bodyBrandTemplateId }}\",\n  \"data\": {\n    \"page_number\": {\n      \"type\": \"text\",\n      \"text\": \"{{ $json.page_number }}\"\n    },\n    \"body\": {\n      \"type\": \"text\",\n      \"text\": {{ JSON.stringify($json.body) }}\n    }\n  }\n}",
  264.               "type": "string"
  265.             }
  266.           ]
  267.         },
  268.         "options": {}
  269.       },
  270.       "type": "n8n-nodes-base.set",
  271.       "typeVersion": 3.4,
  272.       "position": [
  273.         220,
  274.         380
  275.       ],
  276.       "id": "0201d3d4-e0e7-4d3b-988e-be70e03ac9e1",
  277.       "name": "Set body fields"
  278.     },
  279.     {
  280.       "parameters": {
  281.         "amount": 1
  282.       },
  283.       "type": "n8n-nodes-base.wait",
  284.       "typeVersion": 1.1,
  285.       "position": [
  286.         660,
  287.         560
  288.       ],
  289.       "id": "4f52705c-9457-4e1e-bf3f-5d84da82749a",
  290.       "name": "Wait (1s)",
  291.       "webhookId": "6fe31313-1f24-48bf-9e69-cf7f3dbbb540"
  292.     },
  293.     {
  294.       "parameters": {
  295.         "amount": 2
  296.       },
  297.       "type": "n8n-nodes-base.wait",
  298.       "typeVersion": 1.1,
  299.       "position": [
  300.         660,
  301.         280
  302.       ],
  303.       "id": "0bc348d0-a406-4fdc-b3fb-c1b5a5a23e87",
  304.       "name": "Wait (2s)",
  305.       "webhookId": "adeef8e1-a4ea-4188-b044-a79677bdf756"
  306.     },
  307.     {
  308.       "parameters": {
  309.         "httpRequestMethod": "POST",
  310.         "graphApiVersion": "v22.0",
  311.         "node": "={{ $('Set run variables').item.json.instagramAccountID }}",
  312.         "edge": "media",
  313.         "options": {
  314.           "queryParameters": {
  315.             "parameter": [
  316.               {
  317.                 "name": "image_url",
  318.                 "value": "={{ $json.job.urls[0] }}"
  319.               },
  320.               {
  321.                 "name": "is_carousel_item",
  322.                 "value": "true"
  323.               }
  324.             ]
  325.           }
  326.         }
  327.       },
  328.       "type": "n8n-nodes-base.facebookGraphApi",
  329.       "typeVersion": 1,
  330.       "position": [
  331.         1320,
  332.         620
  333.       ],
  334.       "id": "f4d2e9bb-4921-4e72-a64a-3e533ee97c41",
  335.       "name": "Create page container",
  336.       "credentials": {
  337.         "facebookGraphApi": {
  338.           "id": "lhGNyyzLNlHxgmT4",
  339.           "name": "@companiamedios Instagram"
  340.         }
  341.       }
  342.     },
  343.     {
  344.       "parameters": {
  345.         "jsCode": "// Este Function Node toma múltiples items con campos \"id\"\n// y genera un solo item con un array \"children\"\n\nconst children = items.map(item => item.json.id);\n\nreturn [\n  {\n    json: {\n      children: children\n    }\n  }\n];"
  346.       },
  347.       "type": "n8n-nodes-base.code",
  348.       "typeVersion": 2,
  349.       "position": [
  350.         0,
  351.         -60
  352.       ],
  353.       "id": "a272c4bc-7a0f-4d48-850a-0764762f6c6b",
  354.       "name": "Build children table"
  355.     },
  356.     {
  357.       "parameters": {
  358.         "httpRequestMethod": "POST",
  359.         "graphApiVersion": "v22.0",
  360.         "node": "={{ $('Set run variables').first().json.instagramAccountID }}",
  361.         "edge": "media",
  362.         "options": {
  363.           "queryParameters": {
  364.             "parameter": [
  365.               {
  366.                 "name": "media_type",
  367.                 "value": "CAROUSEL"
  368.               },
  369.               {
  370.                 "name": "children",
  371.                 "value": "={{ $json.children }}"
  372.               },
  373.               {
  374.                 "name": "caption",
  375.                 "value": "={{ $('Generate post').first().json.choices[0].message.content.caption }}"
  376.               }
  377.             ]
  378.           }
  379.         }
  380.       },
  381.       "type": "n8n-nodes-base.facebookGraphApi",
  382.       "typeVersion": 1,
  383.       "position": [
  384.         220,
  385.         -60
  386.       ],
  387.       "id": "b67f80a6-29ca-4f8a-a0d4-67d1ad4bb3bc",
  388.       "name": "Create carousel container",
  389.       "credentials": {
  390.         "facebookGraphApi": {
  391.           "id": "lhGNyyzLNlHxgmT4",
  392.           "name": "@companiamedios Instagram"
  393.         }
  394.       }
  395.     },
  396.     {
  397.       "parameters": {
  398.         "httpRequestMethod": "POST",
  399.         "graphApiVersion": "v22.0",
  400.         "node": "={{ $('Set run variables').first().json.instagramAccountID }}",
  401.         "edge": "media_publish",
  402.         "options": {
  403.           "queryParameters": {
  404.             "parameter": [
  405.               {
  406.                 "name": "creation_id",
  407.                 "value": "={{ $('Create carousel container').item.json.id }}"
  408.               }
  409.             ]
  410.           }
  411.         }
  412.       },
  413.       "type": "n8n-nodes-base.facebookGraphApi",
  414.       "typeVersion": 1,
  415.       "position": [
  416.         440,
  417.         -60
  418.       ],
  419.       "id": "ca2bb78d-73b6-4fb2-bebb-ae26cc760a70",
  420.       "name": "Post carousel",
  421.       "credentials": {
  422.         "facebookGraphApi": {
  423.           "id": "lhGNyyzLNlHxgmT4",
  424.           "name": "@companiamedios Instagram"
  425.         }
  426.       },
  427.       "onError": "continueRegularOutput"
  428.     },
  429.     {
  430.       "parameters": {
  431.         "method": "POST",
  432.         "url": "https://api.canva.com/rest/v1/autofills",
  433.         "authentication": "genericCredentialType",
  434.         "genericAuthType": "oAuth2Api",
  435.         "sendBody": true,
  436.         "specifyBody": "json",
  437.         "jsonBody": "={{ $json.request_body }}",
  438.         "options": {}
  439.       },
  440.       "type": "n8n-nodes-base.httpRequest",
  441.       "typeVersion": 4.2,
  442.       "position": [
  443.         440,
  444.         280
  445.       ],
  446.       "id": "fa05549c-5635-4ce7-b29b-bac57a6dabc4",
  447.       "name": "Create design job",
  448.       "credentials": {
  449.         "oAuth2Api": {
  450.           "id": "bWv1B5JaqBFfkb9P",
  451.           "name": "Canva Oauth2"
  452.         }
  453.       }
  454.     },
  455.     {
  456.       "parameters": {
  457.         "method": "POST",
  458.         "url": "https://api.canva.com/rest/v1/folders/move",
  459.         "authentication": "genericCredentialType",
  460.         "genericAuthType": "oAuth2Api",
  461.         "sendBody": true,
  462.         "bodyParameters": {
  463.           "parameters": [
  464.             {
  465.               "name": "to_folder_id",
  466.               "value": "={{ $('Create generation folder').item.json.folder.id }}"
  467.             },
  468.             {
  469.               "name": "item_id",
  470.               "value": "={{ $json.job.result.design.id }}"
  471.             }
  472.           ]
  473.         },
  474.         "options": {}
  475.       },
  476.       "type": "n8n-nodes-base.httpRequest",
  477.       "typeVersion": 4.2,
  478.       "position": [
  479.         1320,
  480.         340
  481.       ],
  482.       "id": "c11dec10-b9ff-4ad1-a7d2-1dbbb92a5067",
  483.       "name": "Add to generation folder",
  484.       "credentials": {
  485.         "oAuth2Api": {
  486.           "id": "bWv1B5JaqBFfkb9P",
  487.           "name": "Canva Oauth2"
  488.         }
  489.       }
  490.     },
  491.     {
  492.       "parameters": {
  493.         "assignments": {
  494.           "assignments": [
  495.             {
  496.               "id": "67f4ef4d-d9be-4198-89f8-160bb5472acd",
  497.               "name": "instagramAccountID",
  498.               "value": "Get this from your Facebook Developer portal!",
  499.               "type": "string"
  500.             },
  501.             {
  502.               "id": "6c645fc6-5ef4-4356-8f8b-171a0f8e47bc",
  503.               "name": "coverBrandTemplateId",
  504.               "value": "Get this from the Canva list brand templates API!",
  505.               "type": "string"
  506.             },
  507.             {
  508.               "id": "2ee0e51b-c257-4918-9418-bf08b9534a20",
  509.               "name": "bodyBrandTemplateId",
  510.               "value": "Get this from the Canva list brand templates API!",
  511.               "type": "string"
  512.             },
  513.             {
  514.               "id": "68629cfc-971b-4955-8e94-6ca2c67150ba",
  515.               "name": "generationParentFolderId",
  516.               "value": "Get this from the Canva list folders API!",
  517.               "type": "string"
  518.             }
  519.           ]
  520.         },
  521.         "includeOtherFields": true,
  522.         "include": "selected",
  523.         "includeFields": "Tema",
  524.         "options": {}
  525.       },
  526.       "type": "n8n-nodes-base.set",
  527.       "typeVersion": 3.4,
  528.       "position": [
  529.         -1620,
  530.         100
  531.       ],
  532.       "id": "09a1366d-2cb6-422c-8582-075ea8824a8e",
  533.       "name": "Set run variables"
  534.     },
  535.     {
  536.       "parameters": {
  537.         "formTitle": "Create a news post",
  538.         "formFields": {
  539.           "values": [
  540.             {
  541.               "fieldLabel": "Topic",
  542.               "fieldType": "textarea",
  543.               "placeholder": "Ukraine's assault on Russian targets using drones",
  544.               "requiredField": true
  545.             },
  546.             {
  547.               "fieldLabel": "Questions to answer",
  548.               "fieldType": "textarea",
  549.               "placeholder": "Why did he do this?"
  550.             },
  551.             {
  552.               "fieldLabel": "Search recommendations",
  553.               "fieldType": "textarea",
  554.               "placeholder": "Look for reputable sources like The New York Times..."
  555.             }
  556.           ]
  557.         },
  558.         "options": {}
  559.       },
  560.       "type": "n8n-nodes-base.formTrigger",
  561.       "typeVersion": 2.2,
  562.       "position": [
  563.         -1840,
  564.         100
  565.       ],
  566.       "id": "4ee94e74-9a36-4378-9c2a-eaa6b3fc3054",
  567.       "name": "Form",
  568.       "webhookId": "500d0884-f614-459f-a3ec-7901462d6b3e"
  569.     },
  570.     {
  571.       "parameters": {
  572.         "modelId": {
  573.           "__rl": true,
  574.           "value": "google/gemini-2.5-pro-preview",
  575.           "mode": "list",
  576.           "cachedResultName": "GOOGLE/GEMINI-2.5-PRO-PREVIEW"
  577.         },
  578.         "messages": {
  579.           "values": [
  580.             {
  581.               "content": "=<prompt>\n  <system>\n    You are an editorial assistant specialized in digital communication. Your task is to transform a news summary into an informative post optimized for a Canva carousel. The content must be visually clear, professional, and easy to understand for a general audience. \n    Follow the data provided in the source exactly: respect **dates, figures, places, proper names, and chronological sequences**. Do not omit or alter relevant facts.\n  </system>\n\n  <output_format>\n    Return <only>valid JSON</only> (no markdown, no comments).\n\n    The JSON must have exactly this top-level structure:\n    {\n      \"caption\": \"\",\n      \"pages\": [ … ]\n    }\n\n    <caption>\n      Brief text for social media platforms like Instagram or TikTok.\n      <requirements>\n        <max_characters>2200</max_characters>\n        <ideal_characters>≤300</ideal_characters>\n        <hashtags>maximum 10, minimum 3</hashtags>\n        <emojis>none</emojis>\n        <cta>Include a call to action like “Follow us for more news.” Be creative with the call to action. It must appear in the caption.</cta>\n        <style>informative, clear, neutral, and easy to understand</style>\n      </requirements>\n    </caption>\n\n    <pages>\n      Each element must have:\n      <fields>\n        <type>\"cover\" or \"body\"</type>\n        <page_number>format \"n/N\"</page_number>\n        <if_cover>\n          <title>maximum 64 characters (ideal ≤ 50)</title>\n        </if_cover>\n        <if_body>\n          <body>maximum 240 characters</body>\n        </if_body>\n      </fields>\n    </pages>\n  </output_format>\n\n  <constraints>\n    <rule>There must be exactly ONE \"cover\" page</rule>\n    <rule>There must be between 1 and 11 \"body\" pages</rule>\n    <rule>Total maximum: 12 pages</rule>\n    <rule>Ideal total number of pages: 6 to 8</rule>\n    <rule>Do not use emojis</rule>\n    <rule>Do not use hashtags on the pages (only in the caption)</rule>\n    <rule>Do not include quotes or textual references</rule>\n    <rule>Calculate the total page numbering correctly in the format \"n/N\"</rule>\n    <rule>Use informative, direct, neutral, and easy-to-follow language</rule>\n    <rule>Include statistics, figures, or relevant data exactly as they appear in the collected information. Do not invent or modify them</rule>\n    <rule>Preserve dates, names, and key data exactly as they appear in the source</rule>\n    <rule>Avoid value judgments; maintain an objective and professional tone</rule>\n  </constraints>\n\n  <input>\n    <topic>{{ $('Form').item.json.Topic }}</topic>\n    <questions_to_answer>\n      {{ $('Form').item.json['Questions to answer'] }}\n    </questions_to_answer>\n    <collected_information>\n      {{ $json.choices[0].message.content }}\n    </collected_information>\n  </input>\n\n  <output>\n    Return only the JSON.\n  </output>\n</prompt>",
  582.               "role": "system"
  583.             }
  584.           ]
  585.         },
  586.         "simplify": false,
  587.         "jsonOutput": true,
  588.         "options": {}
  589.       },
  590.       "type": "@n8n/n8n-nodes-langchain.openAi",
  591.       "typeVersion": 1.8,
  592.       "position": [
  593.         -800,
  594.         100
  595.       ],
  596.       "id": "545777a8-847d-4e95-9c41-3485c8702e4d",
  597.       "name": "Generate post",
  598.       "credentials": {
  599.         "openAiApi": {
  600.           "id": "6EP5FRSkgeyD1crg",
  601.           "name": "OpenRouter"
  602.         }
  603.       }
  604.     },
  605.     {
  606.       "parameters": {
  607.         "modelId": {
  608.           "__rl": true,
  609.           "value": "perplexity/sonar",
  610.           "mode": "list",
  611.           "cachedResultName": "PERPLEXITY/SONAR"
  612.         },
  613.         "messages": {
  614.           "values": [
  615.             {
  616.               "content": "=<prompt>\n  <system>\n    You are a helpful research assistant with access to tools for searching the internet and extracting text from articles.\n  </system>\n\n  <instructions>\n    <step1>Gather updated and accurate information on the topic specified by the user using your internal knowledge.</step1>\n    <step2>Perform between 1 and 3 searches in English or Spanish, depending on the most relevant language for the topic.</step2>\n    <step3>Read the body of promising articles.</step3>\n    <step4>Write a summary based on what you found, citing dates and sources.</step4>\n  </instructions>\n  \n  <rules>\n    <rule1>Include dates, years, and concrete sources in the final summary.</rule1>\n    <rule3>If the article does not contain relevant content, discard it.</rule3>\n    <rule4>Prefer recent and well-structured articles.</rule4>\n    <rule5>Write the summary in English if the topic has better sources in English; otherwise, use Spanish.</rule5>\n    <rule6>Do not use tables or lists; be clear and direct.</rule6>\n  </rules>\n\n  <input>\n    <topic>{{ $('Form').item.json.Topic }}</topic>\n    <questions_to_answer>\n      {{ $('Form').item.json['Questions to answer'] || \"Not specified\" }}\n    </questions_to_answer>\n    <search_recommendations>\n      {{ $('Form').item.json['Search recommendations'] || \"Not specified\" }}\n    </search_recommendations>\n  </input>\n\n  <output>\n    Return your detailed research with cited dates and sources.\n  </output>\n</prompt>",
  617.               "role": "system"
  618.             }
  619.           ]
  620.         },
  621.         "simplify": false,
  622.         "options": {}
  623.       },
  624.       "type": "@n8n/n8n-nodes-langchain.openAi",
  625.       "typeVersion": 1.8,
  626.       "position": [
  627.         -1180,
  628.         100
  629.       ],
  630.       "id": "d4af09fc-c671-4d7d-82d8-ee44a87aaa06",
  631.       "name": "Retrieve information",
  632.       "credentials": {
  633.         "openAiApi": {
  634.           "id": "6EP5FRSkgeyD1crg",
  635.           "name": "OpenRouter"
  636.         }
  637.       }
  638.     },
  639.     {
  640.       "parameters": {
  641.         "content": "# Automated Insta News Account\nThis is a workflow that creates news posts for specified topics by using the Perplexity API to look for information and then processing said information into design templates with the Canva API to then post them on Instagram.\n\n## What do I need?\n* An OpenRouter API Key (for the OpenAI 'Message Model' blocks) \n* A Canva integration set up with Oauth2\n* An Instagram token set up with a Facebook page",
  642.         "height": 300,
  643.         "width": 700
  644.       },
  645.       "type": "n8n-nodes-base.stickyNote",
  646.       "position": [
  647.         -1840,
  648.         -280
  649.       ],
  650.       "typeVersion": 1,
  651.       "id": "fa61c6ea-0d28-49ca-a7f3-edb5140c97c5",
  652.       "name": "Sticky Note"
  653.     },
  654.     {
  655.       "parameters": {
  656.         "method": "POST",
  657.         "url": "https://api.canva.com/rest/v1/folders",
  658.         "authentication": "genericCredentialType",
  659.         "genericAuthType": "oAuth2Api",
  660.         "sendBody": true,
  661.         "bodyParameters": {
  662.           "parameters": [
  663.             {
  664.               "name": "name",
  665.               "value": "generation"
  666.             },
  667.             {
  668.               "name": "parent_folder_id",
  669.               "value": "={{ $('Set run variables').item.json.generationParentFolderId }}"
  670.             }
  671.           ]
  672.         },
  673.         "options": {}
  674.       },
  675.       "type": "n8n-nodes-base.httpRequest",
  676.       "typeVersion": 4.2,
  677.       "position": [
  678.         -1400,
  679.         100
  680.       ],
  681.       "id": "096f16e9-fef9-4c5a-9097-84e27dce2b37",
  682.       "name": "Create generation folder",
  683.       "credentials": {
  684.         "oAuth2Api": {
  685.           "id": "bWv1B5JaqBFfkb9P",
  686.           "name": "Canva Oauth2"
  687.         }
  688.       }
  689.     }
  690.   ],
  691.   "pinData": {},
  692.   "connections": {
  693.     "Create export job": {
  694.       "main": [
  695.         [
  696.           {
  697.             "node": "Wait (1s)",
  698.             "type": "main",
  699.             "index": 0
  700.           }
  701.         ]
  702.       ]
  703.     },
  704.     "Design job done?": {
  705.       "main": [
  706.         [
  707.           {
  708.             "node": "Add to generation folder",
  709.             "type": "main",
  710.             "index": 0
  711.           }
  712.         ],
  713.         [
  714.           {
  715.             "node": "Wait (2s)",
  716.             "type": "main",
  717.             "index": 0
  718.           }
  719.         ]
  720.       ]
  721.     },
  722.     "Get design job status": {
  723.       "main": [
  724.         [
  725.           {
  726.             "node": "Design job done?",
  727.             "type": "main",
  728.             "index": 0
  729.           }
  730.         ]
  731.       ]
  732.     },
  733.     "Get export job status": {
  734.       "main": [
  735.         [
  736.           {
  737.             "node": "Export job done?",
  738.             "type": "main",
  739.             "index": 0
  740.           }
  741.         ]
  742.       ]
  743.     },
  744.     "Export job done?": {
  745.       "main": [
  746.         [
  747.           {
  748.             "node": "Create page container",
  749.             "type": "main",
  750.             "index": 0
  751.           }
  752.         ],
  753.         [
  754.           {
  755.             "node": "Wait (1s)",
  756.             "type": "main",
  757.             "index": 0
  758.           }
  759.         ]
  760.       ]
  761.     },
  762.     "Loop Over Items": {
  763.       "main": [
  764.         [
  765.           {
  766.             "node": "Build children table",
  767.             "type": "main",
  768.             "index": 0
  769.           }
  770.         ],
  771.         [
  772.           {
  773.             "node": "Switch",
  774.             "type": "main",
  775.             "index": 0
  776.           }
  777.         ]
  778.       ]
  779.     },
  780.     "Split out pages": {
  781.       "main": [
  782.         [
  783.           {
  784.             "node": "Loop Over Items",
  785.             "type": "main",
  786.             "index": 0
  787.           }
  788.         ]
  789.       ]
  790.     },
  791.     "Switch": {
  792.       "main": [
  793.         [
  794.           {
  795.             "node": "Set cover fields",
  796.             "type": "main",
  797.             "index": 0
  798.           }
  799.         ],
  800.         [
  801.           {
  802.             "node": "Set body fields",
  803.             "type": "main",
  804.             "index": 0
  805.           }
  806.         ]
  807.       ]
  808.     },
  809.     "Set body fields": {
  810.       "main": [
  811.         [
  812.           {
  813.             "node": "Create design job",
  814.             "type": "main",
  815.             "index": 0
  816.           }
  817.         ]
  818.       ]
  819.     },
  820.     "Set cover fields": {
  821.       "main": [
  822.         [
  823.           {
  824.             "node": "Create design job",
  825.             "type": "main",
  826.             "index": 0
  827.           }
  828.         ]
  829.       ]
  830.     },
  831.     "Wait (1s)": {
  832.       "main": [
  833.         [
  834.           {
  835.             "node": "Get export job status",
  836.             "type": "main",
  837.             "index": 0
  838.           }
  839.         ]
  840.       ]
  841.     },
  842.     "Wait (2s)": {
  843.       "main": [
  844.         [
  845.           {
  846.             "node": "Get design job status",
  847.             "type": "main",
  848.             "index": 0
  849.           }
  850.         ]
  851.       ]
  852.     },
  853.     "Create page container": {
  854.       "main": [
  855.         [
  856.           {
  857.             "node": "Loop Over Items",
  858.             "type": "main",
  859.             "index": 0
  860.           }
  861.         ]
  862.       ]
  863.     },
  864.     "Build children table": {
  865.       "main": [
  866.         [
  867.           {
  868.             "node": "Create carousel container",
  869.             "type": "main",
  870.             "index": 0
  871.           }
  872.         ]
  873.       ]
  874.     },
  875.     "Create carousel container": {
  876.       "main": [
  877.         [
  878.           {
  879.             "node": "Post carousel",
  880.             "type": "main",
  881.             "index": 0
  882.           }
  883.         ]
  884.       ]
  885.     },
  886.     "Create design job": {
  887.       "main": [
  888.         [
  889.           {
  890.             "node": "Wait (2s)",
  891.             "type": "main",
  892.             "index": 0
  893.           }
  894.         ]
  895.       ]
  896.     },
  897.     "Add to generation folder": {
  898.       "main": [
  899.         [
  900.           {
  901.             "node": "Create export job",
  902.             "type": "main",
  903.             "index": 0
  904.           }
  905.         ]
  906.       ]
  907.     },
  908.     "Set run variables": {
  909.       "main": [
  910.         [
  911.           {
  912.             "node": "Create generation folder",
  913.             "type": "main",
  914.             "index": 0
  915.           }
  916.         ]
  917.       ]
  918.     },
  919.     "Form": {
  920.       "main": [
  921.         [
  922.           {
  923.             "node": "Set run variables",
  924.             "type": "main",
  925.             "index": 0
  926.           }
  927.         ]
  928.       ]
  929.     },
  930.     "Generate post": {
  931.       "main": [
  932.         [
  933.           {
  934.             "node": "Split out pages",
  935.             "type": "main",
  936.             "index": 0
  937.           }
  938.         ]
  939.       ]
  940.     },
  941.     "Retrieve information": {
  942.       "main": [
  943.         [
  944.           {
  945.             "node": "Generate post",
  946.             "type": "main",
  947.             "index": 0
  948.           }
  949.         ]
  950.       ]
  951.     },
  952.     "Post carousel": {
  953.       "main": [
  954.         []
  955.       ]
  956.     },
  957.     "Create generation folder": {
  958.       "main": [
  959.         [
  960.           {
  961.             "node": "Retrieve information",
  962.             "type": "main",
  963.             "index": 0
  964.           }
  965.         ]
  966.       ]
  967.     }
  968.   },
  969.   "active": false,
  970.   "settings": {
  971.     "executionOrder": "v1",
  972.     "callerPolicy": "workflowsFromSameOwner",
  973.     "executionTimeout": 390
  974.   },
  975.   "versionId": "94f9b6bf-2ccf-460b-b038-29268691ccf3",
  976.   "meta": {
  977.     "templateCredsSetupCompleted": true,
  978.     "instanceId": "ffed4dcd350beadc352cb0370a59ec55e15bd43b9d2e31253e1d07d45fb3e581"
  979.   },
  980.   "id": "06m384bjdsJi5tMr",
  981.   "tags": []
  982. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement