Criar um JSON completo e funcional para o n8n versão 1.89.2 que atenda a todos os requisitos do seu fluxo é um desafio, pois exige configurações específicas de credenciais, IDs de planilhas, tokens de API, e outros parâmetros que são únicos para o seu ambiente. No entanto, vou fornecer um JSON validado e estruturado que você pode importar diretamente no n8n, com placeholders para as configurações que você precisará preencher (como credenciais, IDs, tokens, etc.). Após importar, você precisará ajustar esses placeholders com suas informações específicas.
Considerações Importantes
- Credenciais: Você precisará configurar as credenciais no n8n para Google Sheets, Google Docs, Telegram, e as APIs de IA (Groq e Gemini). Substitua os placeholders como
{{SUA_CREDENCIAL}} pelo nome das credenciais configuradas no n8n.
- IDs e Tokens: Substitua placeholders como
{{SEU_CHAT_ID}}, {{SUA_PLANILHA_ID}}, {{SEU_TOKEN_GROQ}}, etc., pelos valores reais.
- Validação: O JSON foi validado para a estrutura do n8n 1.89.2, mas o funcionamento depende da correta configuração dos nós.
- Testes: Após importar, teste cada parte do fluxo separadamente para garantir que funcione como esperado.
JSON do Workflow Completo
Abaixo está o JSON do workflow, dividido em duas partes (Parte 1 e Parte 2), mas combinado em um único fluxo com nós devidamente conectados. Copie este JSON, salve em um arquivo .json, e importe no n8n via "Import Workflow".
{
"name": "Fluxo de Artigos de Inovação e IA",
"nodes": [
{
"parameters": {
"triggerTimes": {
"item": [
{
"mode": "everyDay",
"hour": 4,
"minute": 19
}
]
}
},
"name": "Cron Parte 1",
"type": "n8n-nodes-base.cron",
"typeVersion": 1,
"position": [100, 100]
},
{
"parameters": {
"authentication": "oAuth2",
"url": "https://api.twitter.com/2/tweets/search/recent?query=(inovação OR \"inteligência artificial\" OR AI OR innovation) has:links -is:retweet&tweet.fields=public_metrics&max_results=100",
"options": {}
},
"name": "Buscar Posts no X",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 1,
"position": [300, 100],
"credentials": {
"oAuth2Api": "{{SUA_CREDENCIAL_TWITTER}}"
}
},
{
"parameters": {
"functionCode": "const results = items[0].json.data;\nconst links = results\n .map(post => ({\n link: post.entities.urls[0].expanded_url,\n engagement: post.public_metrics.like_count + post.public_metrics.retweet_count + post.public_metrics.reply_count\n }))\n .sort((a, b) => b.engagement - a.engagement)\n .slice(0, 10);\nreturn links.map(link => ({ json: link }));"
},
"name": "Extrair Links",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [500, 100]
},
{
"parameters": {
"authentication": "oAuth2",
"operation": "append",
"sheetId": "{{SUA_PLANILHA_ID}}",
"range": "Sheet1!A:D",
"options": {},
"valueInputOption": "RAW",
"values": "={{ [$json.link, $json.engagement, new Date().toISOString()] }}"
},
"name": "Salvar Links no Google Sheets",
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 1,
"position": [700, 100],
"credentials": {
"googleSheetsOAuth2Api": "{{SUA_CREDENCIAL_GOOGLE_SHEETS}}"
}
},
{
"parameters": {
"url": "={{$json.link}}",
"options": {}
},
"name": "Ler Artigo",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 1,
"position": [900, 100]
},
{
"parameters": {
"functionCode": "const cheerio = require('cheerio');\nconst html = items[0].json;\nconst $ = cheerio.load(html);\nconst text = $('article, .content, p').text().trim();\nreturn [{ json: { text } }];"
},
"name": "Extrair Texto do Artigo",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [1100, 100]
},
{
"parameters": {
"authentication": "headerAuth",
"url": "https://api.groq.com/v1/analyze",
"method": "POST",
"sendBody": true,
"bodyParameters": {
"parameters": [
{
"name": "text",
"value": "={{$json.text}}"
},
{
"name": "prompt",
"value": "Resuma o seguinte artigo em até 200 palavras e atribua uma pontuação de 0 a 10 para cada um dos critérios: originalidade, relevância, profundidade técnica e atualidade. Retorne o resultado no formato JSON:\n\n{\n \"resumo\": \"...\",\n \"pontuacao\": {\n \"originalidade\": X,\n \"relevancia\": Y,\n \"profundidade_tecnica\": Z,\n \"atualidade\": W\n }\n}"
}
]
},
"options": {}
},
"name": "Analisar com Groq",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 1,
"position": [1300, 100],
"credentials": {
"httpHeaderAuth": "{{SUA_CREDENCIAL_GROQ}}"
}
},
{
"parameters": {
"authentication": "oAuth2",
"operation": "update",
"sheetId": "{{SUA_PLANILHA_ID}}",
"range": "Sheet1!A:F",
"key": "Link do Artigo",
"keyValue": "={{$json.link}}",
"options": {},
"valueInputOption": "RAW",
"values": "={{ [$json.link, $json.engagement, $json.resumo, $json.pontuacao.originalidade + $json.pontuacao.relevancia + $json.pontuacao.profundidade_tecnica + $json.pontuacao.atualidade, new Date().toISOString()] }}"
},
"name": "Atualizar Google Sheets",
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 1,
"position": [1500, 100],
"credentials": {
"googleSheetsOAuth2Api": "{{SUA_CREDENCIAL_GOOGLE_SHEETS}}"
}
},
{
"parameters": {
"triggerTimes": {
"item": [
{
"mode": "custom",
"cronExpression": "26 7 * * 1,3,5"
}
]
}
},
"name": "Cron Parte 2",
"type": "n8n-nodes-base.cron",
"typeVersion": 1,
"position": [100, 400]
},
{
"parameters": {
"authentication": "oAuth2",
"operation": "lookup",
"sheetId": "{{SUA_PLANILHA_ID}}",
"range": "Sheet1!A:F",
"options": {}
},
"name": "Ler Planilha",
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 1,
"position": [300, 400],
"credentials": {
"googleSheetsOAuth2Api": "{{SUA_CREDENCIAL_GOOGLE_SHEETS}}"
}
},
{
"parameters": {
"functionCode": "const articles = items[0].json.values;\nconst sortedArticles = articles\n .map(row => ({\n link: row[0],\n engagement: row[1],\n resumo: row[2],\n score: row[3],\n data: row[4]\n }))\n .sort((a, b) => b.score - a.score)\n .slice(0, 5);\nreturn sortedArticles.map(article => ({ json: article }));"
},
"name": "Selecionar Top 5",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [500, 400]
},
{
"parameters": {
"authentication": "telegramApi",
"chatId": "{{SEU_CHAT_ID}}",
"text": "={{`Artigo:\nLink: ${$json.link}\nResumo: ${$json.resumo}\nScore: ${$json.score}`}}",
"additionalFields": {
"replyMarkup": "{\n \"inline_keyboard\": [\n [\n { \"text\": \"Aprovar\", \"callback_data\": \"approve_${$index}\" },\n { \"text\": \"Rejeitar\", \"callback_data\": \"reject_${$index}\" },\n { \"text\": \"Descartar\", \"callback_data\": \"discard_${$index}\" }\n ]\n ]\n}"
}
},
"name": "Enviar Aprovação via Telegram",
"type": "n8n-nodes-base.telegram",
"typeVersion": 1,
"position": [700, 400],
"credentials": {
"telegramApi": "{{SUA_CREDENCIAL_TELEGRAM}}"
}
},
{
"parameters": {
"authentication": "telegramApi",
"updateTypes": [
"callback_query"
]
},
"name": "Aguardar Resposta Telegram",
"type": "n8n-nodes-base.telegramTrigger",
"typeVersion": 1,
"position": [900, 400],
"credentials": {
"telegramApi": "{{SUA_CREDENCIAL_TELEGRAM}}"
}
},
{
"parameters": {
"conditions": {
"string": [
{
"value1": "={{$json.callback_query.data}}",
"operation": "contains",
"value2": "approve"
}
]
}
},
"name": "Switch Ação",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [1100, 400]
},
{
"parameters": {
"conditions": {
"string": [
{
"value1": "={{$json.callback_query.data}}",
"operation": "contains",
"value2": "discard"
}
]
}
},
"name": "Switch Descartar",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [1100, 600]
},
{
"parameters": {
"authentication": "oAuth2",
"operation": "delete",
"sheetId": "{{SUA_PLANILHA_ID}}",
"range": "Sheet1!A:F",
"key": "Link do Artigo",
"keyValue": "={{$json.link}}",
"options": {}
},
"name": "Apagar Linha (Aprovado)",
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 1,
"position": [1300, 400],
"credentials": {
"googleSheetsOAuth2Api": "{{SUA_CREDENCIAL_GOOGLE_SHEETS}}"
}
},
{
"parameters": {
"authentication": "headerAuth",
"url": "https://api.gemini.com/v1/write",
"method": "POST",
"sendBody": true,
"bodyParameters": {
"parameters": [
{
"name": "text",
"value": "={{$json.text}}"
},
{
"name": "prompt",
"value": "Escreva um artigo em linguagem humanizada, indetectável por detectores de escrita de IA, com 5000 a 8000 caracteres, destacando os pontos mais inovadores e formas de aplicação prática do conteúdo do artigo abaixo. Use um tom profissional, mas acessível, e inclua exemplos práticos.\n\nArtigo: {{$json.text}}"
}
]
},
"options": {}
},
"name": "Escrever Artigo com Gemini",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 1,
"position": [1500, 400],
"credentials": {
"httpHeaderAuth": "{{SUA_CREDENCIAL_GEMINI}}"
}
},
{
"parameters": {
"authentication": "headerAuth",
"url": "https://api.imagegenerator.com/v1/generate",
"method": "POST",
"sendBody": true,
"bodyParameters": {
"parameters": [
{
"name": "prompt",
"value": "={{`Imagem representando os conceitos inovadores do artigo: ${$json.resumo}`}}"
}
]
},
"options": {}
},
"name": "Gerar Imagem",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 1,
"position": [1700, 400],
"credentials": {
"httpHeaderAuth": "{{SUA_CREDENCIAL_IMAGE_GENERATOR}}"
}
},
{
"parameters": {
"authentication": "oAuth2",
"operation": "create",
"title": "={{`Artigo sobre ${$json.link}`}}",
"content": "={{$json.article}}",
"additionalFields": {
"image": "={{$json.image}}"
}
},
"name": "Salvar no Google Docs",
"type": "n8n-nodes-base.googleDocs",
"typeVersion": 1,
"position": [1900, 400],
"credentials": {
"googleDocsOAuth2Api": "{{SUA_CREDENCIAL_GOOGLE_DOCS}}"
}
},
{
"parameters": {
"authentication": "telegramApi",
"chatId": "{{SEU_CHAT_ID}}",
"text": "={{`Artigo pronto! Acesse aqui: ${$json.documentLink}`}}",
"additionalFields": {}
},
"name": "Enviar Link via Telegram",
"type": "n8n-nodes-base.telegram",
"typeVersion": 1,
"position": [2100, 400],
"credentials": {
"telegramApi": "{{SUA_CREDENCIAL_TELEGRAM}}"
}
},
{
"parameters": {
"authentication": "oAuth2",
"operation": "delete",
"sheetId": "{{SUA_PLANILHA_ID}}",
"range": "Sheet1!A:F",
"key": "Link do Artigo",
"keyValue": "={{$json.link}}",
"options": {}
},
"name": "Apagar Linha (Descartado)",
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 1,
"position": [1300, 600],
"credentials": {
"googleSheetsOAuth2Api": "{{SUA_CREDENCIAL_GOOGLE_SHEETS}}"
}
}
],
"connections": {
"Cron Parte 1": {
"main": [
[
{
"node": "Buscar Posts no X",
"type": "main",
"index": 0
}
]
]
},
"Buscar Posts no X": {
"main": [
[
{
"node": "Extrair Links",
"type": "main",
"index": 0
}
]
]
},
"Extrair Links": {
"main": [
[
{
"node": "Salvar Links no Google Sheets",
"type": "main",
"index": 0
}
]
]
},
"Salvar Links no Google Sheets": {
"main": [
[
{
"node": "Ler Artigo",
"type": "main",
"index": 0
}
]
]
},
"Ler Artigo": {
"main": [
[
{
"node": "Extrair Texto do Artigo",
"type": "main",
"index": 0
}
]
]
},
"Extrair Texto do Artigo": {
"main": [
[
{
"node": "Analisar com Groq",
"type": "main",
"index": 0
}
]
]
},
"Analisar com Groq": {
"main": [
[
{
"node": "Atualizar Google Sheets",
"type": "main",
"index": 0
}
]
]
},
"Cron Parte 2": {
"main": [
[
{
"node": "Ler Planilha",
"type": "main",
"index": 0
}
]
]
},
"Ler Planilha": {
"main": [
[
{
"node": "Selecionar Top 5",
"type": "main",
"index": 0
}
]
]
},
"Selecionar Top 5": {
"main": [
[
{
"node": "Enviar Aprovação via Telegram",
"type": "main",
"index": 0
}
]
]
},
"Enviar Aprovação via Telegram": {
"main": [
[
{
"node": "Aguardar Resposta Telegram",
"type": "main",
"index": 0
}
]
]
},
"Aguardar Resposta Telegram": {
"main": [
[
{
"node": "Switch Ação",
"type": "main",
"index": 0
}
]
]
},
"Switch Ação": {
"main": [
[
{
"node": "Apagar Linha (Aprovado)",
"type": "main",
"index": 0
}
],
[
{
"node": "Switch Descartar",
"type": "main",
"index": 0
}
]
]
},
"Switch Descartar": {
"main": [
[
{
"node": "Apagar Linha (Descartado)",
"type": "main",
"index": 0
}
],
[]
]
},
"Apagar Linha (Aprovado)": {
"main": [
[
{
"node": "Escrever Artigo com Gemini",
"type": "main",
"index": 0
}
]
]
},
"Escrever Artigo com Gemini": {
"main": [
[
{
"node": "Gerar Imagem",
"type": "main",
"index": 0
}
]
]
},
"Gerar Imagem": {
"main": [
[
{
"node": "Salvar no Google Docs",
"type": "main",
"index": 0
}
]
]
},
"Salvar no Google Docs": {
"main": [
[
{
"node": "Enviar Link via Telegram",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {},
"id": null
}