feat: adiciona 12 plugins Descomplicar ao marketplace
Plugins: automacao, crm-ops, design-media, dev-tools, gestao, infraestrutura, marketing, negocio, perfex-dev, project-manager, wordpress + hello-plugin (existente). Totais: 83 skills, 44 agents, 12 datasets.json Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
12
automacao/.claude-plugin/plugin.json
Normal file
12
automacao/.claude-plugin/plugin.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"name": "automacao",
|
||||
"description": "Process automation with n8n workflows, Moloni integration, Dify, Flowise, Typebot, Chatwoot and AI tools. Backed by 9 Dify KB datasets.",
|
||||
"version": "1.0.0",
|
||||
"author": {
|
||||
"name": "Descomplicar - Crescimento Digital",
|
||||
"url": "https://descomplicar.pt"
|
||||
},
|
||||
"homepage": "https://git.descomplicar.pt/ealmeida/descomplicar-plugins",
|
||||
"license": "MIT",
|
||||
"keywords": ["automacao", "n8n", "moloni", "dify", "workflows", "integracao"]
|
||||
}
|
||||
230
automacao/agents/automation-lead.md
Normal file
230
automacao/agents/automation-lead.md
Normal file
@@ -0,0 +1,230 @@
|
||||
---
|
||||
name: automation-lead
|
||||
description: "USAR PROATIVAMENTE para estratégia automação, n8n workflows, AI agents orchestration, MCPs, integração sistemas, roadmap automação. Lidera iniciativas de automação para maximizar eficiência operacional."
|
||||
role: Líder técnico de automação e orquestração
|
||||
domain: Automation
|
||||
model: sonnet
|
||||
tools: Read, Write, Edit, Bash, Glob, Grep, ToolSearch
|
||||
skills:
|
||||
- _core
|
||||
desk_task: 1492
|
||||
desk_project: 65
|
||||
milestone: 274
|
||||
tags:
|
||||
- agent
|
||||
- stackworkflow
|
||||
- claude-code
|
||||
- automation
|
||||
- n8n
|
||||
- orchestration
|
||||
version: "2.0"
|
||||
status: active
|
||||
quality_score: 70
|
||||
compliance:
|
||||
sacred_rules: true
|
||||
excellence_standards: true
|
||||
data_sources: true
|
||||
knowledge_first: true
|
||||
reports_to: CTO
|
||||
collaborates_with:
|
||||
- N8N Automation Expert
|
||||
- MCP Protocol Developer
|
||||
- Development Lead
|
||||
escalates_to:
|
||||
- CTO (decisões estratégicas)
|
||||
- Security Compliance Specialist (segurança workflows)
|
||||
created: "2025-01-13"
|
||||
updated: "2026-02-04"
|
||||
author: "Descomplicar®"
|
||||
---
|
||||
|
||||
# Automation Lead Descomplicar
|
||||
|
||||
Líder técnico de automação que orquestra workflows, coordena AI agents e define estratégias de integração para maximizar eficiência operacional.
|
||||
|
||||
## System Prompt
|
||||
|
||||
Você é o líder de automação responsável por:
|
||||
- Definir roadmap e estratégia de automação
|
||||
- Coordenar implementação de workflows N8N
|
||||
- Orquestrar deployment e monitorização de AI agents
|
||||
- Estabelecer protocolos de integração entre sistemas
|
||||
- Garantir ROI e performance das automações
|
||||
|
||||
### Regras OBRIGATÓRIAS (checklist antes de agir)
|
||||
|
||||
- [ ] **Avaliar ROI**: Automação DEVE poupar mais tempo do que demora a implementar
|
||||
- [ ] **Dados Reais**: Consultar memory-supabase para histórico de automações
|
||||
- [ ] **Arquitectura Primeiro**: Desenhar fluxo ANTES de implementar
|
||||
- [ ] **Error Handling**: Todo workflow DEVE ter tratamento de erros
|
||||
- [ ] **Monitorização**: Definir métricas de sucesso e alertas
|
||||
- [ ] **Documentação**: Workflows DEVEM ter README com trigger, inputs, outputs
|
||||
- [ ] **Evitar Over-Engineering**: Solução simples > complexa quando ambas funcionam
|
||||
|
||||
### Output Format Esperado
|
||||
|
||||
```markdown
|
||||
## Workflow: [Nome]
|
||||
|
||||
### Propósito
|
||||
[Problema que resolve]
|
||||
|
||||
### Arquitectura
|
||||
```
|
||||
Trigger → [Passo 1] → [Passo 2] → Output
|
||||
```
|
||||
|
||||
### Componentes
|
||||
| Tipo | Nome | Função |
|
||||
|------|------|--------|
|
||||
| MCP | desk-crm-v3 | Criar tarefas |
|
||||
| N8N | Webhook | Receber dados |
|
||||
|
||||
### Métricas
|
||||
- **Tempo Poupado**: X horas/semana
|
||||
- **Taxa Sucesso**: >95%
|
||||
- **ROI**: X meses
|
||||
|
||||
### Próximos Passos
|
||||
1. [Acção]
|
||||
2. [Acção]
|
||||
```
|
||||
|
||||
### MCPs a Usar
|
||||
|
||||
| MCP | Quando Usar |
|
||||
|-----|-------------|
|
||||
| `desk-crm-v3` | Criar tarefas, projectos, automação CRM |
|
||||
| `google-workspace` | Email, calendário, docs automation |
|
||||
| `memory-supabase` | Consultar histórico automações |
|
||||
| `gitea` | Versionar workflows N8N |
|
||||
|
||||
## Responsabilidades
|
||||
|
||||
- Liderar estratégia e roadmap de automação
|
||||
- Gerir equipa de automação (N8N, AI agents, MCP specialists)
|
||||
- Design e implementação de workflows automatizados
|
||||
- Coordenar deployments de AI agents
|
||||
- Supervisionar protocolos de integração e APIs
|
||||
- Monitorizar métricas de performance de automação
|
||||
|
||||
## Workflows
|
||||
|
||||
### 1. Avaliar Nova Automação
|
||||
```
|
||||
1. Identificar processo repetitivo (>3x/semana)
|
||||
2. Calcular tempo actual vs. tempo com automação
|
||||
3. Avaliar complexidade técnica
|
||||
4. Decisão: Vale a pena automatizar?
|
||||
5. Se SIM → Criar roadmap implementação
|
||||
```
|
||||
|
||||
### 2. Implementar Workflow N8N
|
||||
```
|
||||
1. Desenhar fluxo (Trigger → Nodes → Output)
|
||||
2. Mapear MCPs e APIs necessários
|
||||
3. Implementar no N8N
|
||||
4. Testar edge cases e erros
|
||||
5. Documentar e activar
|
||||
6. Monitorizar primeiros 7 dias
|
||||
```
|
||||
|
||||
### 3. Coordenar AI Agents
|
||||
```
|
||||
1. Identificar tarefas para delegação
|
||||
2. Seleccionar agente apropriado
|
||||
3. Preparar contexto e instruções
|
||||
4. Lançar via Task tool (background se aplicável)
|
||||
5. Validar output
|
||||
6. Registar performance
|
||||
```
|
||||
|
||||
## Datasets Dify (Consultar SEMPRE)
|
||||
|
||||
```
|
||||
mcp__dify-kb__dify_kb_retrieve_segments dataset:"n8n" query:"workflows automacao integracao"
|
||||
mcp__dify-kb__dify_kb_retrieve_segments dataset:"Ferramentas de Automacao e IA" query:"AI agents orchestration"
|
||||
mcp__dify-kb__dify_kb_retrieve_segments dataset:"Dify" query:"LLM workflows deployment"
|
||||
mcp__dify-kb__dify_kb_retrieve_segments dataset:"Flowise" query:"chatbots automation"
|
||||
```
|
||||
|
||||
## Your Available MCPs
|
||||
|
||||
### Recommended for automation
|
||||
- **n8n** - Workflows automation
|
||||
- **desk-crm-v3** - Clientes, projectos, facturas, time tracking
|
||||
- **ssh-unified** - SSH, SFTP, servidor management
|
||||
- **gitea** - Repositórios Git, issues, PRs
|
||||
- **puppeteer** - Browser automation
|
||||
- **memory-supabase** - Memória longo prazo
|
||||
- **dify-kb** - Knowledge base AI
|
||||
- **filesystem** - Ficheiros locais
|
||||
|
||||
### All Available (33 total)
|
||||
moloni, context7, cwp, google-analytics, google-workspace, imap, outline-api, youtube-research, youtube-uploader, wikijs, gsc, lighthouse, mcp-time, mcp-mermaid, mcp-echarts, powerpoint, penpot, pixabay, pexels, tavily, elevenlabs, magic, vimeo, design-systems, replicate
|
||||
|
||||
**Discovery:** Use ToolSearch to find specific tools.
|
||||
**Example:** `ToolSearch("ssh upload")` finds SSH upload tools.
|
||||
|
||||
|
||||
## Your Available Skills
|
||||
|
||||
### Primary Skills (Your Domain)
|
||||
✓ **/delegate** - Delegar tarefas dev para outros chats Claude com workflow completo - timer, impl
|
||||
- Invoke: `/delegate`
|
||||
|
||||
✓ **/archive** - Arquivamento automatico de ficheiros concluidos - move ficheiros com status done
|
||||
- Invoke: `/archive`
|
||||
|
||||
### Recommended for automation
|
||||
- **/doc-sync** - Sincronização automática de documentação Stack/Vault. Garant
|
||||
- **/time** - Time tracking integrado com Desk CRM. Inicia e para timers e
|
||||
- **/taskforce** - Gestão de TaskForces - pacotes de trabalho padronizados com skills
|
||||
|
||||
### Core Skills (All Agents)
|
||||
- **/reflect** - Auto-reflexão e melhoria contínua do sistema. Analisa sessõe
|
||||
- **/worklog** - Registo automático de trabalho - tarefas, problemas, soluçõe
|
||||
- **/_core** - Padrões fundamentais Descomplicar® - Sacred Rules, Excellenc
|
||||
- **/knowledge** - Gestão unificada de conhecimento - pesquisa inteligente com
|
||||
- **/desk** - Integração com Desk CRM via ficheiro .desk-project. Auto-det
|
||||
|
||||
### All Available (54 total)
|
||||
/billing-check, /crm-ops, /ecommerce, /lead-approach, /orcamento, /saas, /content-marketing-pt, /remotion-video, /seo-content-optimization, /social-media, /video, /ui-ux-pro-max-repo, /brand-voice-generator, /frontend-design, /pptx-generator, /ui-ux-pro-max, /crm-admin, /db-design, /elementor, /mcp-dev, /nextjs, /php-dev, /react-patterns, /woocommerce, /wp-dev, /backup-strategies, /security-audit, /server-health, /wp-performance, /wp-update, /second-brain-repo, /ads, /marketing-strategy, /product, /skill-creator, /sop-creator, /calendar-manager, /interview, /today, /research, /youtube, /seo-audit, /seo-report, /metrics
|
||||
|
||||
**Discovery:** Use the Skill tool to invoke skills.
|
||||
**Example:** `Skill("skill-name")` invokes the skill.
|
||||
|
||||
|
||||
## Colaboração
|
||||
|
||||
- **Reports to**: CTO
|
||||
- **Colabora com**: N8N Automation Expert, MCP Protocol Developer, Development Lead, All department heads
|
||||
- **Escalar para**: CTO (decisões estratégicas), Security Compliance Specialist (segurança workflows)
|
||||
|
||||
|
||||
## Your Team & Responsibilities
|
||||
|
||||
You are part of **2 SDKs** (TaskForce teams):
|
||||
|
||||
### TaskForce Claude Agents
|
||||
|
||||
**Purpose:** NULL
|
||||
|
||||
**Your responsibilities in this TaskForce:**
|
||||
|
||||
- **Sistema de agentes especializados para delegacao de tarefas via Task tool com consulta automatica de datasets Dify.**: NULL
|
||||
|
||||
### TaskForce Claude Workflow
|
||||
|
||||
**Purpose:** NULL
|
||||
|
||||
**Your responsibilities in this TaskForce:**
|
||||
|
||||
- **Sistema de automacao com hooks Claude Code, integracao N8N e gestao de sessoes com auto-triggers.**: NULL
|
||||
|
||||
**Collaboration:**
|
||||
- Work with other agents in your TaskForce teams
|
||||
- Share knowledge and context across team members
|
||||
- Leverage team-specific skills and MCPs
|
||||
- Contribute to team goals and deliverables
|
||||
|
||||
208
automacao/agents/mcp-protocol-developer.md
Normal file
208
automacao/agents/mcp-protocol-developer.md
Normal file
@@ -0,0 +1,208 @@
|
||||
---
|
||||
name: mcp-protocol-developer
|
||||
description: Especialista em desenvolvimento de servidores MCP e integracoes para
|
||||
o ecossistema Model Context Protocol
|
||||
role: Especialista em desenvolvimento de servidores MCP e integracoes para o ecossistema
|
||||
Model Context Protocol
|
||||
domain: Dev
|
||||
model: sonnet
|
||||
tools: Read, Write, Edit, Bash, Glob, Grep, ToolSearch
|
||||
skills:
|
||||
- _core
|
||||
desk_task: 1508
|
||||
desk_project: 65
|
||||
milestone: 274
|
||||
tags:
|
||||
- agent
|
||||
- stackworkflow
|
||||
- claude-code
|
||||
- mcp
|
||||
version: '2.0'
|
||||
status: active
|
||||
quality_score: 70
|
||||
compliance:
|
||||
sacred_rules: true
|
||||
excellence_standards: true
|
||||
data_sources: true
|
||||
knowledge_first: true
|
||||
created: '2025-01-13'
|
||||
updated: '2026-02-04'
|
||||
author: Descomplicar®
|
||||
---
|
||||
|
||||
|
||||
# MCP Protocol Developer Descomplicar
|
||||
|
||||
Especialista em desenvolvimento, optimizacao e manutencao de servidores MCP e ferramentas customizadas que expandem o ecossistema Model Context Protocol.
|
||||
|
||||
## Responsabilidades
|
||||
- Desenvolvimento de servidores MCP customizados em TypeScript/Node.js e Python
|
||||
- Criacao de ferramentas MCP especializadas para requisitos de negocio
|
||||
- Implementacao de error handling robusto e logging para comunicacoes MCP
|
||||
- Design de estrategias de caching e transformacao de dados
|
||||
- Testes de compliance e validacao de protocolo MCP
|
||||
|
||||
## Datasets Dify (Consultar SEMPRE)
|
||||
```
|
||||
mcp__dify-kb__dify_kb_retrieve_segments dataset:"MCP Servers" query:"protocol development tools integration"
|
||||
mcp__dify-kb__dify_kb_retrieve_segments dataset:"Claude Code" query:"MCP server configuration"
|
||||
mcp__dify-kb__dify_kb_retrieve_segments dataset:"Desenvolvimento de Software" query:"typescript nodejs api development"
|
||||
```
|
||||
|
||||
## System Prompt
|
||||
|
||||
### Papel
|
||||
Especialista em desenvolvimento, optimizacao e manutencao de servidores MCP e ferramentas customizadas que expandem o ecossistema Model Context Protocol.
|
||||
|
||||
### Regras Obrigatórias
|
||||
1. SEMPRE seguir MCP Specification oficial (Anthropic)
|
||||
2. Transport: stdio (local) ou SSE (gateway)
|
||||
3. Error handling robusto (NEVER throw sem catch)
|
||||
4. Logging estruturado (DEBUG mode disponível)
|
||||
5. CHANGELOG.md actualizado (Regra #9)
|
||||
6. README com instalação, configuração, exemplos
|
||||
|
||||
### Output Format
|
||||
- Código TypeScript/Python bem tipado
|
||||
- package.json/pyproject.toml correcto
|
||||
- Testes de integração MCP
|
||||
- Documentação (README + inline comments)
|
||||
- Exemplo de configuração (.json)
|
||||
|
||||
## Workflows
|
||||
|
||||
### Workflow 1: Criar Novo MCP Server
|
||||
1. Analisar requisitos (ferramentas, resources, prompts)
|
||||
2. Escolher language (TS/Node.js ou Python)
|
||||
3. Scaffold com `@modelcontextprotocol/sdk`
|
||||
4. Implementar tools com validação
|
||||
5. Error handling + logging
|
||||
6. Testes + README + CHANGELOG
|
||||
|
||||
### Workflow 2: Implementar Tool MCP
|
||||
1. Design de schema (input parameters, output format)
|
||||
2. Validação de inputs (Zod para TS, Pydantic para Python)
|
||||
3. Lógica de negócio (chamadas APIs, DB, filesystem)
|
||||
4. Error handling (try/catch, mensagens claras)
|
||||
5. Response formatting (JSON structured)
|
||||
6. Unit tests
|
||||
|
||||
### Workflow 3: Migrar para SSE (Gateway)
|
||||
1. Verificar MCP funciona em stdio
|
||||
2. Adicionar `@modelcontextprotocol/server-sse`
|
||||
3. Configurar endpoint HTTP (Express/Fastify)
|
||||
4. CORS e autenticação (se necessário)
|
||||
5. Deploy em EasyPanel
|
||||
6. Configurar no gateway (Nginx proxy)
|
||||
|
||||
## MCPs Relevantes
|
||||
- `gitea`: Gestão de código MCP
|
||||
- `desk-crm-v3`: Tracking desenvolvimento (Proj #65, Milestone 256)
|
||||
- `dify-kb`: KB MCP Servers, Claude Code, Desenvolvimento Software
|
||||
- `ssh-unified`: Deploy em servidores
|
||||
|
||||
## Colaboracao
|
||||
- Reports to: Development Lead
|
||||
- Colabora com: System developers, Database specialists, Automation experts
|
||||
|
||||
## Your Available MCPs
|
||||
|
||||
### Primary MCPs (Your Domain)
|
||||
✓ **desk-crm-v3** (business)
|
||||
- Clientes, projectos, facturas, time tracking
|
||||
- Usage: `mcp__desk-crm-v3__*`
|
||||
|
||||
✓ **gitea** (dev)
|
||||
- Repositórios Git, issues, PRs
|
||||
- Usage: `mcp__gitea__*`
|
||||
|
||||
✓ **ssh-unified** (infra)
|
||||
- SSH, SFTP, servidor management
|
||||
- Usage: `mcp__ssh-unified__*`
|
||||
|
||||
✓ **dify-kb** (knowledge)
|
||||
- Knowledge base AI
|
||||
- Usage: `mcp__dify-kb__*`
|
||||
|
||||
### Recommended for dev
|
||||
- **context7** - Context documentation
|
||||
- **n8n** - Workflows automation
|
||||
- **filesystem** - Ficheiros locais
|
||||
- **magic** - AI-powered UI component generation (tipo v0.dev)
|
||||
- **memory-supabase** - Memória longo prazo
|
||||
- **cwp** - CentOS Web Panel
|
||||
- **puppeteer** - Browser automation
|
||||
|
||||
### All Available (33 total)
|
||||
moloni, google-analytics, google-workspace, imap, outline-api, youtube-research, youtube-uploader, wikijs, gsc, lighthouse, mcp-time, mcp-mermaid, mcp-echarts, powerpoint, penpot, pixabay, pexels, tavily, elevenlabs, vimeo, design-systems, replicate
|
||||
|
||||
**Discovery:** Use ToolSearch to find specific tools.
|
||||
**Example:** `ToolSearch("ssh upload")` finds SSH upload tools.
|
||||
|
||||
|
||||
## Your Available Skills
|
||||
|
||||
### Primary Skills (Your Domain)
|
||||
✓ **/wp-dev** - Desenvolvimento WordPress especializado - plugins, temas, WooCommerce. Usar para
|
||||
- Invoke: `/wp-dev`
|
||||
|
||||
✓ **/php-dev** - Desenvolvimento PHP fullstack - Laravel, Symfony, APIs RESTful, arquitectura bac
|
||||
- Invoke: `/php-dev`
|
||||
|
||||
✓ **/db-design** - Design de bases de dados - schema, optimização queries, MySQL/PostgreSQL, arquit
|
||||
- Invoke: `/db-design`
|
||||
|
||||
✓ **/mcp-dev** - Desenvolvimento de servidores MCP - criar, configurar, testar e documentar MCPs
|
||||
- Invoke: `/mcp-dev`
|
||||
|
||||
### Recommended for dev
|
||||
- **/react-patterns** - Padrões React modernos - Hooks, Server Components, State Man
|
||||
- **/nextjs** - Desenvolvimento Next.js moderno com App Router, Server Compo
|
||||
- **/elementor** - Desenvolvimento avançado com Elementor Pro e Crocoblock - wi
|
||||
- **/woocommerce** - Desenvolvimento e optimização de lojas WooCommerce - checkou
|
||||
- **/crm-admin** - Administração e desenvolvimento Perfex CRM - gestão dados, m
|
||||
- **/video** - Criar vídeos programáticos com Remotion e React. Gera intros
|
||||
- **/doc-sync** - Sincronização automática de documentação Stack/Vault. Garant
|
||||
- **/delegate** - Delegar tarefas dev para outros chats Claude com workflow co
|
||||
- **/time** - Time tracking integrado com Desk CRM. Inicia e para timers e
|
||||
|
||||
### Core Skills (All Agents)
|
||||
- **/reflect** - Auto-reflexão e melhoria contínua do sistema. Analisa sessõe
|
||||
- **/worklog** - Registo automático de trabalho - tarefas, problemas, soluçõe
|
||||
- **/_core** - Padrões fundamentais Descomplicar® - Sacred Rules, Excellenc
|
||||
- **/knowledge** - Gestão unificada de conhecimento - pesquisa inteligente com
|
||||
- **/desk** - Integração com Desk CRM via ficheiro .desk-project. Auto-det
|
||||
|
||||
### All Available (54 total)
|
||||
/billing-check, /crm-ops, /ecommerce, /lead-approach, /orcamento, /saas, /content-marketing-pt, /remotion-video, /seo-content-optimization, /social-media, /ui-ux-pro-max-repo, /brand-voice-generator, /frontend-design, /pptx-generator, /ui-ux-pro-max, /backup-strategies, /security-audit, /server-health, /wp-performance, /wp-update, /second-brain-repo, /ads, /marketing-strategy, /product, /skill-creator, /sop-creator, /calendar-manager, /interview, /today, /research, /youtube, /seo-audit, /seo-report, /archive, /metrics, /sdk
|
||||
|
||||
**Discovery:** Use the Skill tool to invoke skills.
|
||||
**Example:** `Skill("skill-name")` invokes the skill.
|
||||
|
||||
|
||||
## Your Team & Responsibilities
|
||||
|
||||
You are part of **2 SDKs** (TaskForce teams):
|
||||
|
||||
### TaskForce Claude Agents
|
||||
|
||||
**Purpose:** NULL
|
||||
|
||||
**Your responsibilities in this TaskForce:**
|
||||
|
||||
- **Sistema de agentes especializados para delegacao de tarefas via Task tool com consulta automatica de datasets Dify.**: NULL
|
||||
|
||||
### TaskForce MCP
|
||||
|
||||
**Purpose:** NULL
|
||||
|
||||
**Your responsibilities in this TaskForce:**
|
||||
|
||||
- **Desenvolvimento de servidores MCP - criar, configurar, testar e publicar MCPs customizados com padrões Descomplicar.**: NULL
|
||||
|
||||
**Collaboration:**
|
||||
- Work with other agents in your TaskForce teams
|
||||
- Share knowledge and context across team members
|
||||
- Leverage team-specific skills and MCPs
|
||||
- Contribute to team goals and deliverables
|
||||
|
||||
193
automacao/agents/n8n-automation-expert.md
Normal file
193
automacao/agents/n8n-automation-expert.md
Normal file
@@ -0,0 +1,193 @@
|
||||
---
|
||||
name: n8n-automation-expert
|
||||
description: Especialista em automacao de processos usando N8N para criacao de workflows
|
||||
inteligentes e integracao de sistemas
|
||||
role: Especialista em automacao de processos usando N8N para criacao de workflows
|
||||
inteligentes e integracao de sistemas
|
||||
domain: Automation
|
||||
model: sonnet
|
||||
tools: Read, Write, Edit, Bash, Glob, Grep, ToolSearch
|
||||
skills:
|
||||
- _core
|
||||
desk_task: 1509
|
||||
desk_project: 65
|
||||
milestone: 274
|
||||
tags:
|
||||
- agent
|
||||
- stackworkflow
|
||||
- claude-code
|
||||
- n8n
|
||||
version: '2.0'
|
||||
status: active
|
||||
quality_score: 70
|
||||
compliance:
|
||||
sacred_rules: true
|
||||
excellence_standards: true
|
||||
data_sources: true
|
||||
knowledge_first: true
|
||||
created: '2025-01-13'
|
||||
updated: '2026-02-04'
|
||||
author: Descomplicar®
|
||||
---
|
||||
|
||||
|
||||
# N8N Automation Expert Descomplicar
|
||||
|
||||
Especialista em design, desenvolvimento e optimizacao de workflows automatizados usando N8N para automacao de processos e integracao seamless de sistemas.
|
||||
|
||||
## Responsabilidades
|
||||
- Design e implementacao de workflows N8N complexos
|
||||
- Criacao de integracoes API e webhooks para automacao em tempo real
|
||||
- Transformacao e mapeamento de dados entre sistemas
|
||||
- Implementacao de error handling robusto e retry logic
|
||||
- Monitorizacao e alertas para saude dos workflows
|
||||
|
||||
## Datasets Dify (Consultar SEMPRE)
|
||||
```
|
||||
mcp__dify-kb__dify_kb_retrieve_segments dataset:"n8n" query:"workflow automation nodes triggers"
|
||||
mcp__dify-kb__dify_kb_retrieve_segments dataset:"Ferramentas de Automacao e IA" query:"process automation integration"
|
||||
mcp__dify-kb__dify_kb_retrieve_segments dataset:"Dify" query:"AI automation workflows"
|
||||
```
|
||||
|
||||
## System Prompt
|
||||
|
||||
### Papel
|
||||
Especialista em design, desenvolvimento e optimizacao de workflows automatizados usando N8N para automacao de processos e integracao seamless de sistemas.
|
||||
|
||||
### Regras Obrigatórias
|
||||
1. SEMPRE começar com trigger apropriado (webhook, schedule, manual)
|
||||
2. Error handling em TODOS os nós críticos
|
||||
3. Retry logic para chamadas API (3x com backoff)
|
||||
4. Logging de execuções (success/failure)
|
||||
5. Credentials seguras (N8N secrets, nunca hardcode)
|
||||
6. Documentação de workflow (notas em nós)
|
||||
|
||||
### Output Format
|
||||
- Workflow N8N exportado (.json)
|
||||
- Diagrama visual de fluxo (screenshot ou Mermaid)
|
||||
- Documentação (triggers, inputs, outputs, error handling)
|
||||
- Guia de configuração (credentials, variáveis)
|
||||
- Casos de teste (input → output esperado)
|
||||
|
||||
## Workflows
|
||||
|
||||
### Workflow 1: Criar Workflow do Zero
|
||||
1. Identificar trigger (webhook, cron, evento)
|
||||
2. Mapear lógica de negócio (fluxograma)
|
||||
3. Implementar em N8N (nós, conexões)
|
||||
4. Transformações de dados (Set, Code, Merge)
|
||||
5. Error handling + retry (Error Trigger)
|
||||
6. Testes end-to-end
|
||||
|
||||
### Workflow 2: Integração API Externa
|
||||
1. Analisar documentação API (endpoints, auth, rate limits)
|
||||
2. Configurar credentials N8N (OAuth2/API Key)
|
||||
3. HTTP Request node com headers
|
||||
4. Parsing de response (JSON/XML)
|
||||
5. Error handling (status codes, timeouts)
|
||||
6. Retry policy (exponential backoff)
|
||||
|
||||
### Workflow 3: Automação CRM → Email Marketing
|
||||
**Exemplo: Lead novo no Desk → Add ao Mailchimp**
|
||||
1. Trigger: Webhook do Desk (lead criado)
|
||||
2. Parse webhook payload
|
||||
3. Enrich data (pesquisa empresa, score)
|
||||
4. Conditional: Se score >60 → Mailchimp
|
||||
5. Add to audience com tags
|
||||
6. Notificação Slack (success/failure)
|
||||
|
||||
## MCPs Relevantes
|
||||
- `desk-crm-v3`: Dados para automações (leads, tarefas)
|
||||
- `dify-kb`: KB n8n, Ferramentas Automação, Dify
|
||||
- `memory-supabase`: Histórico de workflows criados
|
||||
|
||||
## Colaboracao
|
||||
- Reports to: Automation Lead
|
||||
- Colabora com: Developers, System integrators, Business analysts
|
||||
|
||||
## Your Available MCPs
|
||||
|
||||
### Primary MCPs (Your Domain)
|
||||
✓ **desk-crm-v3** (business)
|
||||
- Clientes, projectos, facturas, time tracking
|
||||
- Usage: `mcp__desk-crm-v3__*`
|
||||
|
||||
✓ **n8n** (dev)
|
||||
- Workflows automation
|
||||
- Usage: `mcp__n8n__*`
|
||||
|
||||
✓ **dify-kb** (knowledge)
|
||||
- Knowledge base AI
|
||||
- Usage: `mcp__dify-kb__*`
|
||||
|
||||
✓ **memory-supabase** (system)
|
||||
- Memória longo prazo
|
||||
- Usage: `mcp__memory-supabase__*`
|
||||
|
||||
### Recommended for automation
|
||||
- **ssh-unified** - SSH, SFTP, servidor management
|
||||
- **gitea** - Repositórios Git, issues, PRs
|
||||
- **puppeteer** - Browser automation
|
||||
- **filesystem** - Ficheiros locais
|
||||
|
||||
### All Available (33 total)
|
||||
moloni, context7, cwp, google-analytics, google-workspace, imap, outline-api, youtube-research, youtube-uploader, wikijs, gsc, lighthouse, mcp-time, mcp-mermaid, mcp-echarts, powerpoint, penpot, pixabay, pexels, tavily, elevenlabs, magic, vimeo, design-systems, replicate
|
||||
|
||||
**Discovery:** Use ToolSearch to find specific tools.
|
||||
**Example:** `ToolSearch("ssh upload")` finds SSH upload tools.
|
||||
|
||||
|
||||
## Your Available Skills
|
||||
|
||||
### Primary Skills (Your Domain)
|
||||
✓ **/delegate** - Delegar tarefas dev para outros chats Claude com workflow completo - timer, impl
|
||||
- Invoke: `/delegate`
|
||||
|
||||
✓ **/archive** - Arquivamento automatico de ficheiros concluidos - move ficheiros com status done
|
||||
- Invoke: `/archive`
|
||||
|
||||
### Recommended for automation
|
||||
- **/doc-sync** - Sincronização automática de documentação Stack/Vault. Garant
|
||||
- **/time** - Time tracking integrado com Desk CRM. Inicia e para timers e
|
||||
- **/taskforce** - Gestão de TaskForces - pacotes de trabalho padronizados com skills
|
||||
|
||||
### Core Skills (All Agents)
|
||||
- **/reflect** - Auto-reflexão e melhoria contínua do sistema. Analisa sessõe
|
||||
- **/worklog** - Registo automático de trabalho - tarefas, problemas, soluçõe
|
||||
- **/_core** - Padrões fundamentais Descomplicar® - Sacred Rules, Excellenc
|
||||
- **/knowledge** - Gestão unificada de conhecimento - pesquisa inteligente com
|
||||
- **/desk** - Integração com Desk CRM via ficheiro .desk-project. Auto-det
|
||||
|
||||
### All Available (54 total)
|
||||
/billing-check, /crm-ops, /ecommerce, /lead-approach, /orcamento, /saas, /content-marketing-pt, /remotion-video, /seo-content-optimization, /social-media, /video, /ui-ux-pro-max-repo, /brand-voice-generator, /frontend-design, /pptx-generator, /ui-ux-pro-max, /crm-admin, /db-design, /elementor, /mcp-dev, /nextjs, /php-dev, /react-patterns, /woocommerce, /wp-dev, /backup-strategies, /security-audit, /server-health, /wp-performance, /wp-update, /second-brain-repo, /ads, /marketing-strategy, /product, /skill-creator, /sop-creator, /calendar-manager, /interview, /today, /research, /youtube, /seo-audit, /seo-report, /metrics
|
||||
|
||||
**Discovery:** Use the Skill tool to invoke skills.
|
||||
**Example:** `Skill("skill-name")` invokes the skill.
|
||||
|
||||
|
||||
## Your Team & Responsibilities
|
||||
|
||||
You are part of **2 SDKs** (TaskForce teams):
|
||||
|
||||
### TaskForce Claude Agents
|
||||
|
||||
**Purpose:** NULL
|
||||
|
||||
**Your responsibilities in this TaskForce:**
|
||||
|
||||
- **Sistema de agentes especializados para delegacao de tarefas via Task tool com consulta automatica de datasets Dify.**: NULL
|
||||
|
||||
### TaskForce Claude Workflow
|
||||
|
||||
**Purpose:** NULL
|
||||
|
||||
**Your responsibilities in this TaskForce:**
|
||||
|
||||
- **Sistema de automacao com hooks Claude Code, integracao N8N e gestao de sessoes com auto-triggers.**: NULL
|
||||
|
||||
**Collaboration:**
|
||||
- Work with other agents in your TaskForce teams
|
||||
- Share knowledge and context across team members
|
||||
- Leverage team-specific skills and MCPs
|
||||
- Contribute to team goals and deliverables
|
||||
|
||||
15
automacao/knowledge/datasets.json
Normal file
15
automacao/knowledge/datasets.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"description": "Dify KB datasets for Automation domain",
|
||||
"query_tool": "mcp__dify-kb__dify_kb_retrieve_segments",
|
||||
"datasets": [
|
||||
{"id": "f14521df-c44a-48f0-8703-b1d1cf77ca05", "name": "n8n", "priority": 1, "document_count": 1, "word_count": 206928},
|
||||
{"id": "44d1517b-65b8-4d81-8253-5683ff0b8830", "name": "Dify", "priority": 1, "document_count": 4, "word_count": 1244175},
|
||||
{"id": "b0a5e9e6-0d39-4e56-8c61-72c8e14ca41d", "name": "Flowise", "priority": 2, "document_count": 3, "word_count": 245565},
|
||||
{"id": "b3e994c9-f642-4f23-a3db-8d9e344d489f", "name": "Typebot", "priority": 2, "document_count": 1, "word_count": 79608},
|
||||
{"id": "728bed1f-79cb-4e56-aa8a-8dd961197354", "name": "Chatwoot", "priority": 2, "document_count": 7, "word_count": 149615},
|
||||
{"id": "76f14ca9-7e11-4924-9ebc-ccd79876aa78", "name": "Baserow", "priority": 2, "document_count": 1, "word_count": 53665},
|
||||
{"id": "ebf7e4aa-5d2c-49f0-bbb3-f73711a9e0b3", "name": "Open WebUI", "priority": 2, "document_count": 3, "word_count": 15266191},
|
||||
{"id": "22f1d0cf-0661-4a5d-ad0e-b3c1cd2c234a", "name": "Ferramentas Automacao e IA", "priority": 1, "document_count": 41, "word_count": 805400},
|
||||
{"id": "a8987108-2121-4e55-b055-67fe70f8aae0", "name": "Moodle", "priority": 3, "document_count": 40, "word_count": 764457}
|
||||
]
|
||||
}
|
||||
110
automacao/skills/moloni-api/SKILL.md
Normal file
110
automacao/skills/moloni-api/SKILL.md
Normal file
@@ -0,0 +1,110 @@
|
||||
---
|
||||
name: moloni-api
|
||||
description: >-
|
||||
Moloni API v2 para facturacao portuguesa - autenticacao, documentos, clientes, produtos.
|
||||
Usar quando trabalhar com Moloni API, criar/consultar facturas, recibos, notas de credito,
|
||||
clientes, ou qualquer operacao de facturacao via Moloni. Triggers: moloni, factura, recibo,
|
||||
nota de credito, billing, invoicing, facturacao portuguesa.
|
||||
---
|
||||
|
||||
# Moloni API v2
|
||||
|
||||
Operações de facturação portuguesa via Moloni API. MCP server disponível em `/opt/moloni/`.
|
||||
|
||||
## 4 Regras Críticas
|
||||
|
||||
1. **`access_token` na QUERY STRING** - Nunca no POST body (causa 403)
|
||||
2. **Endpoints camelCase** - `creditNotes/`, `invoiceReceipts/`, `documentSets/`
|
||||
3. **Arrays form-encoded** - `payments[0][payment_method_id]`, nunca `json.dumps()`
|
||||
4. **`net_value` = Total COM IVA** - Nome enganador! Desk `total` = Moloni `net_value`. Base = `net_value / 1.23`
|
||||
|
||||
## Autenticação
|
||||
|
||||
```python
|
||||
# Grant = GET (não POST!)
|
||||
r = requests.get('https://api.moloni.pt/v2/grant/', params={
|
||||
'grant_type': 'password',
|
||||
'client_id': 'evidentedespertar',
|
||||
'client_secret': 'aa48e86bd574bf81ca2d7f624c8b5de0284fb97d',
|
||||
'username': 'contabilidade@descomplicar.pt',
|
||||
'password': '6EMVh^RHA)d5k!%s' # %s literal, sem f-string!
|
||||
})
|
||||
token = r.json()['access_token']
|
||||
```
|
||||
|
||||
## Empresa
|
||||
|
||||
| Campo | Valor |
|
||||
|-------|-------|
|
||||
| Company ID | 69473 |
|
||||
| Série D | document_set_id: 630300 |
|
||||
| Transf. Bancária | payment_method_id: 400878 |
|
||||
|
||||
## Formato Chamadas
|
||||
|
||||
```python
|
||||
# CORRECTO
|
||||
r = requests.post('https://api.moloni.pt/v2/invoices/getAll/',
|
||||
params={'access_token': token}, # token aqui!
|
||||
data={'company_id': '69473', 'qty': '50'} # dados aqui
|
||||
)
|
||||
```
|
||||
|
||||
## Workflows Comuns
|
||||
|
||||
### Listar facturas
|
||||
```python
|
||||
data = {'company_id': '69473', 'document_set_id': '630300', 'qty': '50', 'offset': '0'}
|
||||
```
|
||||
|
||||
### Criar recibo
|
||||
```python
|
||||
data = {
|
||||
'company_id': '69473',
|
||||
'date': '2026-02-05',
|
||||
'document_set_id': '630300',
|
||||
'customer_id': str(customer_id),
|
||||
'net_value': str(valor),
|
||||
'associated_documents[0][associated_id]': str(invoice_document_id),
|
||||
'associated_documents[0][value]': str(valor),
|
||||
'payments[0][payment_method_id]': '400878',
|
||||
'payments[0][date]': '2026-02-05',
|
||||
'payments[0][value]': str(valor),
|
||||
'status': '1'
|
||||
}
|
||||
r = requests.post('.../receipts/insert/', params={'access_token': token}, data=data)
|
||||
```
|
||||
|
||||
### Verificar reconciliação
|
||||
Antes de criar recibo, verificar `reconciled_value` e `reverse_associated_documents` da factura.
|
||||
|
||||
## Restrições
|
||||
|
||||
- Data mínima documentos: **>= 2025-10-28** (período AT)
|
||||
- Para facturas antigas: usar data actual no recibo
|
||||
|
||||
## Erros Comuns
|
||||
|
||||
| Erro | Causa | Solução |
|
||||
|------|-------|---------|
|
||||
| 403 Forbidden | Token no body | Mover para `params=` |
|
||||
| 404 Not Found | Case errado ou sem `/` | Verificar camelCase + trailing slash |
|
||||
| `["12 date >= ..."]` | Data antiga | Usar data actual |
|
||||
| `["10 associated_id"]` | Factura já reconciliada | Verificar `reconciled_value` |
|
||||
|
||||
## MCP vs API Directa
|
||||
|
||||
O MCP Moloni (`mcp__moloni__*`) gere tokens automaticamente. Para operações pontuais ou scripts batch, usar API directa via SSH no mcp-hub.
|
||||
|
||||
## Sandbox (Desenvolvimento)
|
||||
|
||||
Para testes sem afectar dados reais: https://www.moloni.pt/dev/sandbox/
|
||||
|
||||
A sandbox fornece um ambiente isolado com dados fictícios para desenvolvimento e testes de integração.
|
||||
|
||||
## Referências
|
||||
|
||||
- **[references/api-reference.md](references/api-reference.md)** - Credenciais, formatos, mapeamento clientes, erros
|
||||
- **[references/endpoints.md](references/endpoints.md)** - Catálogo completo de endpoints
|
||||
- **Docs oficiais:** https://www.moloni.pt/dev/endpoints/
|
||||
- **Sandbox:** https://www.moloni.pt/dev/sandbox/
|
||||
301
automacao/skills/moloni-api/references/api-reference.md
Normal file
301
automacao/skills/moloni-api/references/api-reference.md
Normal file
@@ -0,0 +1,301 @@
|
||||
# Moloni API v2 - Reference
|
||||
|
||||
## Empresa Descomplicar
|
||||
|
||||
| Campo | Valor |
|
||||
|-------|-------|
|
||||
| Company ID | 69473 |
|
||||
| Empresa | Evidente Despertar, Lda |
|
||||
| Client ID | evidentedespertar |
|
||||
| NIF | 516557498 |
|
||||
| MCP Server | `/opt/moloni/` em mcp-hub |
|
||||
| Service | `moloni.service` (systemd) |
|
||||
| .env | `/opt/moloni/.env` |
|
||||
| Token storage | `/opt/moloni/.moloni/69473/.token_metadata.json` |
|
||||
|
||||
## Sandbox (Desenvolvimento/Testes)
|
||||
|
||||
Para testar integrações sem afectar dados reais: https://www.moloni.pt/dev/sandbox/
|
||||
|
||||
A sandbox fornece um ambiente isolado com dados fictícios. Usar sempre que:
|
||||
- Desenvolver novas integrações
|
||||
- Testar criação/modificação de documentos
|
||||
- Depurar erros de formato ou validação
|
||||
|
||||
## Autenticacao
|
||||
|
||||
### Password Grant (GET, nao POST!)
|
||||
|
||||
```python
|
||||
r = requests.get('https://api.moloni.pt/v2/grant/', params={
|
||||
'grant_type': 'password',
|
||||
'client_id': 'evidentedespertar',
|
||||
'client_secret': 'aa48e86bd574bf81ca2d7f624c8b5de0284fb97d',
|
||||
'username': 'contabilidade@descomplicar.pt',
|
||||
'password': '6EMVh^RHA)d5k!%s'
|
||||
})
|
||||
token = r.json()['access_token']
|
||||
```
|
||||
|
||||
### Refresh Token
|
||||
|
||||
```python
|
||||
r = requests.get('https://api.moloni.pt/v2/grant/', params={
|
||||
'grant_type': 'refresh_token',
|
||||
'client_id': 'evidentedespertar',
|
||||
'client_secret': 'aa48e86bd574bf81ca2d7f624c8b5de0284fb97d',
|
||||
'refresh_token': '<refresh_token>'
|
||||
})
|
||||
```
|
||||
|
||||
### Regras de Autenticacao
|
||||
|
||||
- Grant endpoint e **GET** (nao POST)
|
||||
- Password contem `%s` - em Python usar: `'6EMVh^RHA)d5k!%s'` (string literal, sem f-string)
|
||||
- Token expira em 3600 segundos (1 hora)
|
||||
- Refresh token nao expira mas so pode ser usado uma vez
|
||||
|
||||
## Formato das Chamadas API
|
||||
|
||||
### Regra Fundamental
|
||||
|
||||
```
|
||||
access_token -> QUERY STRING (params)
|
||||
dados -> POST BODY (data, form-urlencoded)
|
||||
```
|
||||
|
||||
### Exemplo Correcto
|
||||
|
||||
```python
|
||||
r = requests.post('https://api.moloni.pt/v2/invoices/getAll/',
|
||||
params={'access_token': token}, # token na query string
|
||||
data={'company_id': '69473', 'qty': '50'} # dados no body
|
||||
)
|
||||
```
|
||||
|
||||
### Exemplo INCORRECTO (causa 403 Forbidden)
|
||||
|
||||
```python
|
||||
# ERRADO - token no body causa 403!
|
||||
r = requests.post('https://api.moloni.pt/v2/invoices/getAll/',
|
||||
data={'company_id': '69473', 'access_token': token, 'qty': '50'}
|
||||
)
|
||||
```
|
||||
|
||||
## Endpoints Case-Sensitive
|
||||
|
||||
| Correcto (camelCase) | ERRADO (lowercase) |
|
||||
|---------------------|---------------------|
|
||||
| `creditNotes/` | `creditnotes/` |
|
||||
| `invoiceReceipts/` | `invoicereceipts/` |
|
||||
| `documentSets/` | `documentsets/` |
|
||||
| `paymentMethods/` | `paymentmethods/` |
|
||||
| `simplifiedInvoices/` | `simplifiedinvoices/` |
|
||||
| `debitNotes/` | `debitnotes/` |
|
||||
| `billsOfLading/` | `billsoflading/` |
|
||||
| `deliveryNotes/` | `deliverynotes/` |
|
||||
| `proFormaInvoices/` | `proformainvoices/` |
|
||||
|
||||
Endpoints simples (lowercase OK): `invoices/`, `receipts/`, `customers/`, `products/`, `taxes/`
|
||||
|
||||
Todos os endpoints precisam de trailing slash: `/v2/invoices/getAll/`
|
||||
|
||||
## Arrays Aninhados (Form-Encoded)
|
||||
|
||||
### Formato Correcto
|
||||
|
||||
```python
|
||||
data = {
|
||||
'company_id': '69473',
|
||||
'associated_documents[0][associated_id]': '595002190',
|
||||
'associated_documents[0][value]': '2361.60',
|
||||
'payments[0][payment_method_id]': '400878',
|
||||
'payments[0][date]': '2026-02-05',
|
||||
'payments[0][value]': '2361.60',
|
||||
}
|
||||
```
|
||||
|
||||
### Multiplos Items
|
||||
|
||||
```python
|
||||
data = {
|
||||
'products[0][product_id]': '123',
|
||||
'products[0][qty]': '2',
|
||||
'products[0][price]': '50.00',
|
||||
'products[1][product_id]': '456',
|
||||
'products[1][qty]': '1',
|
||||
'products[1][price]': '100.00',
|
||||
}
|
||||
```
|
||||
|
||||
### NUNCA Usar JSON.dumps()
|
||||
|
||||
```python
|
||||
# ERRADO - Moloni nao aceita JSON strings dentro de form data
|
||||
data = {
|
||||
'associated_documents': json.dumps([{'associated_id': 123, 'value': 50}])
|
||||
}
|
||||
```
|
||||
|
||||
## Restricoes de Datas
|
||||
|
||||
- Moloni tem data minima para criacao de documentos (periodo de comunicacao AT)
|
||||
- Actualmente: **>= 2025-10-28**
|
||||
- Para documentos com datas antigas, usar a data actual no recibo/documento
|
||||
- Erro retornado: `["12 date >= 2025-10-28"]`
|
||||
|
||||
## Series Documentais
|
||||
|
||||
| ID | Nome | Uso |
|
||||
|----|------|-----|
|
||||
| 630300 | D | Serie principal (facturas, recibos, NC) |
|
||||
| 118898 | (antiga) | Recibos antigos KCCG |
|
||||
|
||||
## Metodos de Pagamento
|
||||
|
||||
| ID | Nome |
|
||||
|----|------|
|
||||
| 400868 | Numerario |
|
||||
| 400873 | Cheque |
|
||||
| 400878 | Transferencia Bancaria |
|
||||
| 400883 | Multibanco |
|
||||
| 1569000 | Paypal |
|
||||
|
||||
## Endpoints por Tipo de Documento
|
||||
|
||||
Cada tipo de documento suporta: `count`, `getAll`, `getOne`, `insert`, `update`, `delete`
|
||||
|
||||
### Facturas (invoices/)
|
||||
|
||||
```
|
||||
POST /v2/invoices/getAll/ - Listar (qty, offset, document_set_id, customer_id, year)
|
||||
POST /v2/invoices/getOne/ - Detalhe (document_id OU document_set_id+number)
|
||||
POST /v2/invoices/insert/ - Criar
|
||||
```
|
||||
|
||||
### Recibos (receipts/)
|
||||
|
||||
```
|
||||
POST /v2/receipts/getAll/ - Listar
|
||||
POST /v2/receipts/getOne/ - Detalhe
|
||||
POST /v2/receipts/insert/ - Criar (requer: date, document_set_id, customer_id, net_value, associated_documents, payments)
|
||||
```
|
||||
|
||||
**Insert fields:**
|
||||
- `company_id` (int, required)
|
||||
- `date` (YYYY-MM-DD, required)
|
||||
- `document_set_id` (int, required)
|
||||
- `customer_id` (int, required)
|
||||
- `net_value` (float, required) - valor total do recibo
|
||||
- `associated_documents[]` - array com `associated_id` e `value`
|
||||
- `payments[]` - array com `payment_method_id`, `date`, `value`
|
||||
- `status` (0=rascunho, 1=fechado)
|
||||
- `notes` (string, opcional)
|
||||
|
||||
### Notas de Credito (creditNotes/)
|
||||
|
||||
```
|
||||
POST /v2/creditNotes/getAll/
|
||||
POST /v2/creditNotes/getOne/
|
||||
POST /v2/creditNotes/insert/
|
||||
```
|
||||
|
||||
### Clientes (customers/)
|
||||
|
||||
```
|
||||
POST /v2/customers/getAll/
|
||||
POST /v2/customers/getOne/
|
||||
POST /v2/customers/getBySearch/
|
||||
POST /v2/customers/getByVat/
|
||||
```
|
||||
|
||||
### Produtos (products/)
|
||||
|
||||
```
|
||||
POST /v2/products/getAll/
|
||||
POST /v2/products/getBySearch/
|
||||
POST /v2/products/getByReference/
|
||||
```
|
||||
|
||||
## Codigos de Erro Comuns
|
||||
|
||||
| Codigo | Significado |
|
||||
|--------|-------------|
|
||||
| 200 + `{"valid": 1}` | Sucesso |
|
||||
| 200 + `["12 date >= ..."]` | Data anterior ao periodo AT |
|
||||
| 200 + `["10 associated_id"]` | Documento associado invalido ou ja reconciliado |
|
||||
| 200 + `["2 value 0 null"]` | Valor invalido ou em falta |
|
||||
| 401 | Token expirado ou invalido |
|
||||
| 403 | App sem permissoes (access_token no body em vez de query string) |
|
||||
| 404 | Endpoint nao encontrado (verificar case-sensitivity e trailing slash) |
|
||||
|
||||
## Campos de Resposta (Documentos)
|
||||
|
||||
| Campo | Tipo | Descricao |
|
||||
|-------|------|-----------|
|
||||
| `document_id` | int | ID unico do documento |
|
||||
| `number` | int | Numero sequencial na serie |
|
||||
| `net_value` | float | **Total COM IVA** (Desk total). Para base sem IVA: net_value / 1.23. ATENCAO: nome enganador, NAO e base! |
|
||||
| `reconciled_value` | float | Valor ja reconciliado/pago |
|
||||
| `status` | int | 0=rascunho, 1=fechado |
|
||||
| `customer_id` | int | ID do cliente Moloni |
|
||||
| `document_set_id` | int | ID da serie documental |
|
||||
| `associated_documents` | array | Documentos associados (facturas num recibo) |
|
||||
| `reverse_associated_documents` | array | Documentos que referenciam este (recibos de uma factura) |
|
||||
| `payments` | array | Pagamentos registados |
|
||||
| `entity_name` | string | Nome do cliente |
|
||||
| `entity_vat` | string | NIF do cliente |
|
||||
|
||||
## MCP Tools Disponiveis
|
||||
|
||||
O MCP Moloni expoe todas as operacoes via ferramentas prefixadas `mcp__moloni__moloni_`:
|
||||
|
||||
```
|
||||
mcp__moloni__moloni_documents_invoices_getall
|
||||
mcp__moloni__moloni_documents_invoices_getone
|
||||
mcp__moloni__moloni_documents_receipts_insert
|
||||
mcp__moloni__moloni_documents_credit_notes_getall
|
||||
mcp__moloni__moloni_entities_customers_getall
|
||||
mcp__moloni__moloni_settings_paymentmethods_getall
|
||||
mcp__moloni__moloni_settings_documentsets_getall
|
||||
```
|
||||
|
||||
**Nota:** O MCP server ja coloca o `access_token` na query string automaticamente. Quando usar via MCP, nao e necessario gerir tokens manualmente.
|
||||
|
||||
## Mapeamento Clientes Moloni-Desk
|
||||
|
||||
| Moloni customer_id | Nome Moloni | Desk client_id | Nome Desk |
|
||||
|-------------------|-------------|----------------|-----------|
|
||||
| 75731733 | Missao Pertinente | 10 | MIP |
|
||||
| 84748539 | KCCG - Karate Clube de Gaia | 2 | KCG |
|
||||
| 90214681 | IgnitionVortex | 14 | IGV |
|
||||
| 90360913 | Prestigebrokers | 176 | Prestigebrokers |
|
||||
| 90861853 | Cristina Pinto Santos Lda | 17 | SNT Sintricare |
|
||||
| 96914420 | Vasco Miguel Neves, Unipessoal | 21 | Solar FV |
|
||||
| 97615615 | TECIRRIGATION | 22 | TECIRRIGATION |
|
||||
| 98881975 | Miguel Carril | 23 | MCR |
|
||||
| 99321870 | Espiral Senior | 24 | Espiral Senior |
|
||||
| 99581273 | Alegria Todo o Dia | 25 | Alegria Todo o Dia |
|
||||
| 100711528 | ROSSANA FERREIRA | 26 | Family Clinic |
|
||||
| 105780051 | AQUISEVENDE | 28 | AQUISEVENDE |
|
||||
| 128784439 | Carstuff Artigos Para Carrocaria | 139 | CTF Carstuff |
|
||||
|
||||
## Sincronizacao Desk-Moloni (Estado 2026-02-05)
|
||||
|
||||
| Tipo | Total Serie D | Sincronizados |
|
||||
|------|--------------|---------------|
|
||||
| Facturas | 107 | 107 importadas no Desk |
|
||||
| Notas de Credito | 3 | 3 importadas no Desk |
|
||||
| Recibos | 112 | 91 existentes + 21 criados |
|
||||
| Pagamentos | 113 | 110 serie D + 3 serie 118898 |
|
||||
| PDFs | 220 | 107 FT + 110 RC + 3 NC (330 registos: invoice+customer) |
|
||||
|
||||
Status facturas:
|
||||
- Paid: 98 | Partially Paid: 2 (D/36, D/84) | Unpaid: 3 (D/98, D/105, D/106)
|
||||
- Cancelled: 2 (D/56, D/88) | Draft: 2 (D/18, D/66)
|
||||
|
||||
Excluidas da sincronizacao:
|
||||
- FT D/8, D/56, D/88 - anuladas por notas de credito
|
||||
- FT D/98, D/105, D/106 - nao cobradas
|
||||
- FT D/18, D/66 - rascunhos
|
||||
- FT D/3, D/4, D/5 - recibos na serie 118898 (nao D)
|
||||
332
automacao/skills/moloni-api/references/endpoints.md
Normal file
332
automacao/skills/moloni-api/references/endpoints.md
Normal file
@@ -0,0 +1,332 @@
|
||||
# Moloni API - Catalogo Completo de Endpoints
|
||||
|
||||
> Fonte oficial: https://www.moloni.pt/dev/endpoints/
|
||||
> Base URL: `https://api.moloni.pt/v2/`
|
||||
> Todos os endpoints usam POST com `access_token` na query string.
|
||||
> Trailing slash obrigatorio em todos os endpoints.
|
||||
|
||||
## Account & Profile
|
||||
|
||||
### My Profile (myProfile/)
|
||||
| Metodo | Endpoint | Descricao |
|
||||
|--------|----------|-----------|
|
||||
| signup | `myProfile/signup/` | Registar nova conta |
|
||||
| recoverpassword | `myProfile/recoverpassword/` | Recuperar password |
|
||||
| updateMe | `myProfile/updateMe/` | Actualizar perfil |
|
||||
| getMe | `myProfile/getMe/` | Obter dados do perfil |
|
||||
|
||||
## Company
|
||||
|
||||
### Company (companies/)
|
||||
| Metodo | Endpoint | Descricao |
|
||||
|--------|----------|-----------|
|
||||
| freeSlug | `companies/freeSlug/` | Verificar slug disponivel |
|
||||
| getAll | `companies/getAll/` | Listar empresas |
|
||||
| getOne | `companies/getOne/` | Detalhe de empresa |
|
||||
|
||||
### Subscription (subscription/)
|
||||
| Metodo | Endpoint | Descricao |
|
||||
|--------|----------|-----------|
|
||||
| getOne | `subscription/getOne/` | Dados da subscricao |
|
||||
|
||||
### Users (users/)
|
||||
| Metodo | Endpoint | Descricao |
|
||||
|--------|----------|-----------|
|
||||
| getAll | `users/getAll/` | Listar utilizadores |
|
||||
|
||||
## Entities
|
||||
|
||||
### Customers (customers/)
|
||||
| Metodo | Endpoint | Descricao |
|
||||
|--------|----------|-----------|
|
||||
| getAll | `customers/getAll/` | Listar clientes (qty, offset) |
|
||||
| getOne | `customers/getOne/` | Detalhe de cliente |
|
||||
| getBySearch | `customers/getBySearch/` | Pesquisar por texto |
|
||||
| getByVat | `customers/getByVat/` | Pesquisar por NIF |
|
||||
| getByNumber | `customers/getByNumber/` | Pesquisar por numero |
|
||||
| getByEmail | `customers/getByEmail/` | Pesquisar por email |
|
||||
| getByName | `customers/getByName/` | Pesquisar por nome |
|
||||
| getNextNumber | `customers/getNextNumber/` | Proximo numero |
|
||||
| getLastNumber | `customers/getLastNumber/` | Ultimo numero |
|
||||
| getModifiedSince | `customers/getModifiedSince/` | Alterados desde data |
|
||||
| count | `customers/count/` | Total de clientes |
|
||||
| countBySearch | `customers/countBySearch/` | Contar por pesquisa |
|
||||
| countByVat | `customers/countByVat/` | Contar por NIF |
|
||||
| countByNumber | `customers/countByNumber/` | Contar por numero |
|
||||
| countByEmail | `customers/countByEmail/` | Contar por email |
|
||||
| countByName | `customers/countByName/` | Contar por nome |
|
||||
| countModifiedSince | `customers/countModifiedSince/` | Contar alterados |
|
||||
| insert | `customers/insert/` | Criar cliente |
|
||||
| update | `customers/update/` | Actualizar cliente |
|
||||
| delete | `customers/delete/` | Eliminar cliente |
|
||||
|
||||
### Customer Alternate Addresses (customerAlternateAddresses/)
|
||||
| Metodo | Endpoint | Descricao |
|
||||
|--------|----------|-----------|
|
||||
| getAll | `customerAlternateAddresses/getAll/` | Listar moradas |
|
||||
| insert | `customerAlternateAddresses/insert/` | Criar morada |
|
||||
| update | `customerAlternateAddresses/update/` | Actualizar morada |
|
||||
| delete | `customerAlternateAddresses/delete/` | Eliminar morada |
|
||||
|
||||
### Suppliers (suppliers/)
|
||||
| Metodo | Endpoint | Descricao |
|
||||
|--------|----------|-----------|
|
||||
| count | `suppliers/count/` | Total fornecedores |
|
||||
| getAll | `suppliers/getAll/` | Listar fornecedores |
|
||||
| getOne | `suppliers/getOne/` | Detalhe fornecedor |
|
||||
| countBySearch | `suppliers/countBySearch/` | Contar por pesquisa |
|
||||
| getBySearch | `suppliers/getBySearch/` | Pesquisar por texto |
|
||||
| countByVat | `suppliers/countByVat/` | Contar por NIF |
|
||||
| getByVat | `suppliers/getByVat/` | Pesquisar por NIF |
|
||||
| countByNumber | `suppliers/countByNumber/` | Contar por numero |
|
||||
| getByNumber | `suppliers/getByNumber/` | Pesquisar por numero |
|
||||
| countByName | `suppliers/countByName/` | Contar por nome |
|
||||
| getByName | `suppliers/getByName/` | Pesquisar por nome |
|
||||
| insert | `suppliers/insert/` | Criar fornecedor |
|
||||
| update | `suppliers/update/` | Actualizar fornecedor |
|
||||
| delete | `suppliers/delete/` | Eliminar fornecedor |
|
||||
|
||||
### Salesmen (salesmen/)
|
||||
| Metodo | Endpoint | Descricao |
|
||||
|--------|----------|-----------|
|
||||
| count | `salesmen/count/` | Total vendedores |
|
||||
| getAll | `salesmen/getAll/` | Listar vendedores |
|
||||
| getOne | `salesmen/getOne/` | Detalhe vendedor |
|
||||
| countBySearch/getBySearch | Pesquisar por texto |
|
||||
| countByVat/getByVat | Pesquisar por NIF |
|
||||
| countByNumber/getByNumber | Pesquisar por numero |
|
||||
| countByName/getByName | Pesquisar por nome |
|
||||
| countByEmail/getByEmail | Pesquisar por email |
|
||||
| insert | `salesmen/insert/` | Criar vendedor |
|
||||
| update | `salesmen/update/` | Actualizar vendedor |
|
||||
| delete | `salesmen/delete/` | Eliminar vendedor |
|
||||
|
||||
## Products
|
||||
|
||||
### Products (products/)
|
||||
| Metodo | Endpoint | Descricao |
|
||||
|--------|----------|-----------|
|
||||
| count | `products/count/` | Total produtos |
|
||||
| getAll | `products/getAll/` | Listar produtos |
|
||||
| getOne | `products/getOne/` | Detalhe produto |
|
||||
| countBySearch/getBySearch | Pesquisar por texto |
|
||||
| countByName/getByName | Pesquisar por nome |
|
||||
| countByReference/getByReference | Pesquisar por referencia |
|
||||
| countByEAN/getByEAN | Pesquisar por codigo barras |
|
||||
| countModifiedSince/getModifiedSince | Alterados desde data |
|
||||
| getLastCostPrice | `products/getLastCostPrice/` | Ultimo preco de custo |
|
||||
| getNextReference | `products/getNextReference/` | Proxima referencia |
|
||||
| insert | `products/insert/` | Criar produto |
|
||||
| update | `products/update/` | Actualizar produto |
|
||||
| delete | `products/delete/` | Eliminar produto |
|
||||
|
||||
### Product Categories (productCategories/)
|
||||
| Metodo | Endpoint | Descricao |
|
||||
|--------|----------|-----------|
|
||||
| getOne | `productCategories/getOne/` | Detalhe categoria |
|
||||
| getAll | `productCategories/getAll/` | Listar categorias |
|
||||
| insert | `productCategories/insert/` | Criar categoria |
|
||||
| update | `productCategories/update/` | Actualizar categoria |
|
||||
| delete | `productCategories/delete/` | Eliminar categoria |
|
||||
|
||||
### Product Stocks (productStocks/)
|
||||
| Metodo | Endpoint | Descricao |
|
||||
|--------|----------|-----------|
|
||||
| getAll | `productStocks/getAll/` | Listar stocks |
|
||||
| insert | `productStocks/insert/` | Criar stock |
|
||||
| update | `productStocks/update/` | Actualizar stock |
|
||||
| delete | `productStocks/delete/` | Eliminar stock |
|
||||
| moveToWarehouse | `productStocks/moveToWarehouse/` | Mover entre armazens |
|
||||
|
||||
### Price Classes (priceClasses/)
|
||||
| Metodo | Endpoint | Descricao |
|
||||
|--------|----------|-----------|
|
||||
| getAll | `priceClasses/getAll/` | Listar classes preco |
|
||||
| insert | `priceClasses/insert/` | Criar classe preco |
|
||||
| update | `priceClasses/update/` | Actualizar classe preco |
|
||||
| delete | `priceClasses/delete/` | Eliminar classe preco |
|
||||
|
||||
## Documents
|
||||
|
||||
> **ATENCAO Case-Sensitivity!** Endpoints com multiplas palavras usam camelCase.
|
||||
|
||||
### Facturas (invoices/) - lowercase OK
|
||||
| Metodo | Endpoint | Descricao |
|
||||
|--------|----------|-----------|
|
||||
| count | `invoices/count/` | Total facturas |
|
||||
| getAll | `invoices/getAll/` | Listar facturas |
|
||||
| getOne | `invoices/getOne/` | Detalhe factura |
|
||||
| insert | `invoices/insert/` | Criar factura |
|
||||
| update | `invoices/update/` | Actualizar factura |
|
||||
| delete | `invoices/delete/` | Eliminar factura |
|
||||
| generateMbReference | `invoices/generateMbReference/` | Gerar ref MB |
|
||||
|
||||
### Recibos (receipts/) - lowercase OK
|
||||
| Metodo | Endpoint | Descricao |
|
||||
|--------|----------|-----------|
|
||||
| count | `receipts/count/` | Total recibos |
|
||||
| getAll | `receipts/getAll/` | Listar recibos |
|
||||
| getOne | `receipts/getOne/` | Detalhe recibo |
|
||||
| insert | `receipts/insert/` | Criar recibo |
|
||||
| update | `receipts/update/` | Actualizar recibo |
|
||||
| delete | `receipts/delete/` | Eliminar recibo |
|
||||
|
||||
### Notas de Credito (creditNotes/) - CAMELCASE!
|
||||
| Metodo | Endpoint | Descricao |
|
||||
|--------|----------|-----------|
|
||||
| count | `creditNotes/count/` | Total notas credito |
|
||||
| getAll | `creditNotes/getAll/` | Listar notas credito |
|
||||
| getOne | `creditNotes/getOne/` | Detalhe nota credito |
|
||||
| insert | `creditNotes/insert/` | Criar nota credito |
|
||||
| update | `creditNotes/update/` | Actualizar nota credito |
|
||||
| delete | `creditNotes/delete/` | Eliminar nota credito |
|
||||
|
||||
### Notas de Debito (debitNotes/) - CAMELCASE!
|
||||
| Metodo | Endpoint | Descricao |
|
||||
|--------|----------|-----------|
|
||||
| count | `debitNotes/count/` | Total notas debito |
|
||||
| getAll | `debitNotes/getAll/` | Listar notas debito |
|
||||
| getOne | `debitNotes/getOne/` | Detalhe nota debito |
|
||||
| insert | `debitNotes/insert/` | Criar nota debito |
|
||||
| update | `debitNotes/update/` | Actualizar nota debito |
|
||||
| delete | `debitNotes/delete/` | Eliminar nota debito |
|
||||
|
||||
### Facturas Simplificadas (simplifiedInvoices/) - CAMELCASE!
|
||||
| Metodo | Endpoint | Descricao |
|
||||
|--------|----------|-----------|
|
||||
| count | `simplifiedInvoices/count/` | Total |
|
||||
| getAll | `simplifiedInvoices/getAll/` | Listar |
|
||||
| getOne | `simplifiedInvoices/getOne/` | Detalhe |
|
||||
| insert | `simplifiedInvoices/insert/` | Criar |
|
||||
| update | `simplifiedInvoices/update/` | Actualizar |
|
||||
| delete | `simplifiedInvoices/delete/` | Eliminar |
|
||||
| generateMbReference | `simplifiedInvoices/generateMbReference/` | Gerar ref MB |
|
||||
|
||||
### Facturas-Recibo (invoiceReceipts/) - CAMELCASE!
|
||||
| Metodo | Endpoint | Descricao |
|
||||
|--------|----------|-----------|
|
||||
| count | `invoiceReceipts/count/` | Total |
|
||||
| getAll | `invoiceReceipts/getAll/` | Listar |
|
||||
| getOne | `invoiceReceipts/getOne/` | Detalhe |
|
||||
| insert | `invoiceReceipts/insert/` | Criar |
|
||||
| update | `invoiceReceipts/update/` | Actualizar |
|
||||
| delete | `invoiceReceipts/delete/` | Eliminar |
|
||||
| generateMbReference | `invoiceReceipts/generateMbReference/` | Gerar ref MB |
|
||||
|
||||
### Guias de Transporte (billsOfLading/) - CAMELCASE!
|
||||
| Metodo | Endpoint | Descricao |
|
||||
|--------|----------|-----------|
|
||||
| count/getAll/getOne/insert/update/delete | Operacoes standard |
|
||||
| setTransportCode | `billsOfLading/setTransportCode/` | Definir codigo transporte AT |
|
||||
|
||||
### Guias de Remessa (deliveryNotes/) - CAMELCASE!
|
||||
| Metodo | Endpoint | Descricao |
|
||||
|--------|----------|-----------|
|
||||
| count/getAll/getOne/insert/update/delete | Operacoes standard |
|
||||
| setTransportCode | `deliveryNotes/setTransportCode/` | Codigo transporte AT |
|
||||
|
||||
### Facturas de Activos Proprios (ownAssetsInvoices/) - CAMELCASE!
|
||||
Standard: count/getAll/getOne/insert/update/delete
|
||||
|
||||
### Facturas Pro Forma (proFormaInvoices/) - CAMELCASE!
|
||||
Standard: count/getAll/getOne/insert/update/delete
|
||||
|
||||
### Notas de Devolucao (devolutionNotes/) - CAMELCASE!
|
||||
Standard: count/getAll/getOne/insert/update/delete
|
||||
|
||||
### Encomendas (purchaseOrders/) - CAMELCASE!
|
||||
Standard: count/getAll/getOne/insert/update/delete
|
||||
|
||||
### Notas de Consignacao (consignmentNotes/) - CAMELCASE!
|
||||
Standard: count/getAll/getOne/insert/update/delete
|
||||
|
||||
### Notas de Retorno (returnNotes/) - CAMELCASE!
|
||||
Standard: count/getAll/getOne/insert/update/delete
|
||||
|
||||
### Guias de Movimentacao (movementOfGoods/) - CAMELCASE!
|
||||
Standard: count/getAll/getOne/insert/update/delete
|
||||
|
||||
### Guias de Transporte (transportGuide/) - CAMELCASE!
|
||||
Standard + setTransportCode
|
||||
|
||||
### Orcamentos (budget/) - lowercase OK
|
||||
Standard: count/getAll/getOne/insert/update/delete
|
||||
|
||||
### Documentos Internos (internalDocuments/) - CAMELCASE!
|
||||
Standard: count/getAll/getOne/insert/update/delete
|
||||
|
||||
## Settings
|
||||
|
||||
### Contas Bancarias (bankAccounts/) - CAMELCASE!
|
||||
Standard: getAll/insert/update/delete
|
||||
|
||||
### Codigos CAE (caeCodes/) - CAMELCASE!
|
||||
Standard: getAll/insert/update/delete
|
||||
|
||||
### Metodos de Pagamento (paymentMethods/) - CAMELCASE!
|
||||
Standard: getAll/insert/update/delete
|
||||
|
||||
### Prazos de Vencimento (maturityDates/) - CAMELCASE!
|
||||
Standard + countModifiedSince/getModifiedSince
|
||||
|
||||
### Metodos de Entrega (deliveryMethods/) - CAMELCASE!
|
||||
Standard: getAll/insert/update/delete
|
||||
|
||||
### Veiculos (vehicles/) - lowercase OK
|
||||
Standard + getBySearch
|
||||
|
||||
### Deducoes (deductions/) - lowercase OK
|
||||
Standard: getAll/insert/update/delete
|
||||
|
||||
### Impostos (taxes/) - lowercase OK
|
||||
Standard: getAll/insert/update/delete
|
||||
|
||||
### Unidades de Medida (measurementUnits/) - CAMELCASE!
|
||||
Standard: getAll/insert/update/delete
|
||||
|
||||
### Templates de Identificacao (identificationTemplates/) - CAMELCASE!
|
||||
Standard: getAll/insert/update/delete
|
||||
|
||||
### Series Documentais (documentSets/) - CAMELCASE!
|
||||
| Metodo | Endpoint | Descricao |
|
||||
|--------|----------|-----------|
|
||||
| getAll | `documentSets/getAll/` | Listar series |
|
||||
| insert | `documentSets/insert/` | Criar serie |
|
||||
| update | `documentSets/update/` | Actualizar serie |
|
||||
| delete | `documentSets/delete/` | Eliminar serie |
|
||||
| countModifiedSince | `documentSets/countModifiedSince/` | Contar alterados |
|
||||
| getModifiedSince | `documentSets/getModifiedSince/` | Listar alterados |
|
||||
| atInsertCode | `documentSets/atInsertCode/` | Inserir codigo AT |
|
||||
| atInsertCodeBulk | `documentSets/atInsertCodeBulk/` | Inserir codigos AT bulk |
|
||||
|
||||
### Armazens (warehouses/) - lowercase OK
|
||||
Standard + countModifiedSince
|
||||
|
||||
### Propriedades de Produtos (productProperties/) - CAMELCASE!
|
||||
Standard + countModifiedSince/getModifiedSince
|
||||
|
||||
## Global Data
|
||||
|
||||
### Countries (countries/)
|
||||
`countries/getAll/` - Lista de paises (Portugal country_id: 1)
|
||||
|
||||
### Fiscal Zones (fiscalZones/) - CAMELCASE!
|
||||
`fiscalZones/getAll/` - Zonas fiscais
|
||||
|
||||
### Languages (languages/)
|
||||
`languages/getAll/`, `languages/getOne/`
|
||||
|
||||
### Currencies (currencies/)
|
||||
`currencies/getAll/`, `currencies/getOne/` (EUR = id 1)
|
||||
|
||||
### Document Models (documentModels/) - CAMELCASE!
|
||||
`documentModels/getAll/` - Modelos de documento
|
||||
|
||||
### Tax Exemptions (taxExemptions/) - CAMELCASE!
|
||||
`taxExemptions/getAll/` - Lista de isencoes de imposto
|
||||
|
||||
### Currency Exchange (currencyExchange/) - CAMELCASE!
|
||||
`currencyExchange/getAll/`, `currencyExchange/getOne/` - Taxas de cambio
|
||||
|
||||
### Multibanco Gateways (multibancoGateways/) - CAMELCASE!
|
||||
`multibancoGateways/getAll/` - Gateways MB disponiveis
|
||||
279
automacao/skills/n8n-chatbot/SKILL.md
Normal file
279
automacao/skills/n8n-chatbot/SKILL.md
Normal file
@@ -0,0 +1,279 @@
|
||||
# /n8n-chatbot - Chatbots e AI Agents n8n
|
||||
|
||||
Criar chatbots e workflows com AI usando LangChain.
|
||||
|
||||
---
|
||||
|
||||
## Uso
|
||||
|
||||
```
|
||||
/n8n-chatbot create <descrição> # Criar chatbot
|
||||
/n8n-chatbot agent <tipo> # Criar AI agent
|
||||
/n8n-chatbot rag <knowledge_base> # Criar sistema RAG
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Workflow Obrigatório
|
||||
|
||||
```
|
||||
1. Health check → mcp__n8n__n8n_health_check()
|
||||
2. Pesquisar template → mcp__n8n__search_templates({ task: "ai_automation" })
|
||||
3. Se template OK → mcp__n8n__n8n_deploy_template()
|
||||
4. Se criar do zero → Seguir fluxo abaixo
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Nodes LangChain
|
||||
|
||||
### Core
|
||||
|
||||
| Node | Uso |
|
||||
|------|-----|
|
||||
| `@n8n/n8n-nodes-langchain.agent` | AI Agent principal |
|
||||
| `@n8n/n8n-nodes-langchain.chainLlm` | Chain LLM simples |
|
||||
| `@n8n/n8n-nodes-langchain.chainRetrievalQa` | RAG Q&A |
|
||||
|
||||
### Modelos
|
||||
|
||||
| Node | Provider |
|
||||
|------|----------|
|
||||
| `@n8n/n8n-nodes-langchain.lmChatOpenAi` | OpenAI GPT |
|
||||
| `@n8n/n8n-nodes-langchain.lmChatAnthropic` | Claude |
|
||||
| `@n8n/n8n-nodes-langchain.lmChatOllama` | Ollama local |
|
||||
|
||||
### Memória
|
||||
|
||||
| Node | Tipo |
|
||||
|------|------|
|
||||
| `@n8n/n8n-nodes-langchain.memoryBufferWindow` | Últimas N mensagens |
|
||||
| `@n8n/n8n-nodes-langchain.memoryPostgresChat` | PostgreSQL |
|
||||
| `@n8n/n8n-nodes-langchain.memoryRedisChat` | Redis |
|
||||
|
||||
### Tools
|
||||
|
||||
| Node | Função |
|
||||
|------|--------|
|
||||
| `@n8n/n8n-nodes-langchain.toolCalculator` | Cálculos |
|
||||
| `@n8n/n8n-nodes-langchain.toolCode` | Executar código |
|
||||
| `@n8n/n8n-nodes-langchain.toolHttpRequest` | Chamar APIs |
|
||||
| `@n8n/n8n-nodes-langchain.toolWorkflow` | Chamar workflows |
|
||||
|
||||
### Vector Stores (RAG)
|
||||
|
||||
| Node | Sistema |
|
||||
|------|---------|
|
||||
| `@n8n/n8n-nodes-langchain.vectorStoreSupabase` | Supabase |
|
||||
| `@n8n/n8n-nodes-langchain.vectorStorePinecone` | Pinecone |
|
||||
| `@n8n/n8n-nodes-langchain.vectorStorePgVector` | PostgreSQL |
|
||||
|
||||
---
|
||||
|
||||
## Chatbot Básico
|
||||
|
||||
### Estrutura
|
||||
|
||||
```
|
||||
Webhook/Trigger
|
||||
↓
|
||||
LLM Chat Model (OpenAI/Claude)
|
||||
↓
|
||||
Memory (Buffer)
|
||||
↓
|
||||
Agent
|
||||
↓
|
||||
Resposta
|
||||
```
|
||||
|
||||
### Implementação
|
||||
|
||||
```javascript
|
||||
// 1. Modelo LLM
|
||||
mcp__n8n__get_node({
|
||||
nodeType: "@n8n/n8n-nodes-langchain.lmChatOpenAi",
|
||||
detail: "standard"
|
||||
})
|
||||
|
||||
// 2. Memória
|
||||
mcp__n8n__get_node({
|
||||
nodeType: "@n8n/n8n-nodes-langchain.memoryBufferWindow",
|
||||
detail: "standard"
|
||||
})
|
||||
|
||||
// 3. Agent
|
||||
mcp__n8n__get_node({
|
||||
nodeType: "@n8n/n8n-nodes-langchain.agent",
|
||||
detail: "standard"
|
||||
})
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## RAG (Retrieval Augmented Generation)
|
||||
|
||||
### Estrutura
|
||||
|
||||
```
|
||||
Documentos
|
||||
↓
|
||||
Embeddings
|
||||
↓
|
||||
Vector Store
|
||||
↓
|
||||
Query (pergunta)
|
||||
↓
|
||||
Retriever
|
||||
↓
|
||||
LLM (resposta contextualizada)
|
||||
```
|
||||
|
||||
### Configuração Vector Store
|
||||
|
||||
```javascript
|
||||
mcp__n8n__validate_node({
|
||||
nodeType: "@n8n/n8n-nodes-langchain.vectorStoreSupabase",
|
||||
config: {
|
||||
mode: "insert", // ou "retrieve"
|
||||
tableName: "documents",
|
||||
queryName: "match_documents"
|
||||
},
|
||||
mode: "minimal"
|
||||
})
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## AI Agent com Tools
|
||||
|
||||
### Estrutura
|
||||
|
||||
```
|
||||
Input
|
||||
↓
|
||||
Agent
|
||||
├── Tool: Calculator
|
||||
├── Tool: HTTP Request
|
||||
├── Tool: Code
|
||||
└── Tool: Workflow
|
||||
↓
|
||||
Output
|
||||
```
|
||||
|
||||
### Configuração Agent
|
||||
|
||||
```javascript
|
||||
mcp__n8n__validate_node({
|
||||
nodeType: "@n8n/n8n-nodes-langchain.agent",
|
||||
config: {
|
||||
agentType: "conversationalAgent",
|
||||
systemMessage: "Tu és um assistente prestável...",
|
||||
options: {
|
||||
returnIntermediateSteps: true
|
||||
}
|
||||
},
|
||||
mode: "minimal"
|
||||
})
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Exemplos Práticos
|
||||
|
||||
### Chatbot de Suporte
|
||||
|
||||
```
|
||||
Webhook (mensagem cliente)
|
||||
↓
|
||||
Memory PostgreSQL (histórico)
|
||||
↓
|
||||
Vector Store (docs suporte)
|
||||
↓
|
||||
Chain Retrieval QA
|
||||
↓
|
||||
Webhook Response
|
||||
```
|
||||
|
||||
### Agent CRM
|
||||
|
||||
```
|
||||
Webhook (comando)
|
||||
↓
|
||||
Agent
|
||||
├── Tool: Pesquisar clientes
|
||||
├── Tool: Criar lead
|
||||
└── Tool: Actualizar tarefa
|
||||
↓
|
||||
Slack (resultado)
|
||||
```
|
||||
|
||||
### Resumo de Documentos
|
||||
|
||||
```
|
||||
Webhook (upload PDF)
|
||||
↓
|
||||
PDF Extract
|
||||
↓
|
||||
Text Splitter
|
||||
↓
|
||||
LLM Chain (resumo)
|
||||
↓
|
||||
Email (enviar resumo)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Templates Recomendados
|
||||
|
||||
```javascript
|
||||
// AI templates
|
||||
mcp__n8n__search_templates({
|
||||
searchMode: "by_task",
|
||||
task: "ai_automation"
|
||||
})
|
||||
|
||||
// Por keyword
|
||||
mcp__n8n__search_templates({
|
||||
searchMode: "keyword",
|
||||
query: "chatbot langchain openai"
|
||||
})
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Credenciais Necessárias
|
||||
|
||||
| Provider | Credencial | Node |
|
||||
|----------|------------|------|
|
||||
| OpenAI | API Key | lmChatOpenAi |
|
||||
| Anthropic | API Key | lmChatAnthropic |
|
||||
| Supabase | URL + Key | vectorStoreSupabase |
|
||||
| Pinecone | API Key | vectorStorePinecone |
|
||||
|
||||
---
|
||||
|
||||
## Boas Práticas
|
||||
|
||||
| Prática | Razão |
|
||||
|---------|-------|
|
||||
| System prompt claro | Define comportamento |
|
||||
| Temperatura baixa (0.1-0.3) | Respostas consistentes |
|
||||
| Memória limitada | Performance |
|
||||
| Retry on error | Resiliência |
|
||||
| Logs de conversas | Debug e melhoria |
|
||||
|
||||
---
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
| Problema | Solução |
|
||||
|----------|---------|
|
||||
| Respostas inconsistentes | Baixar temperatura |
|
||||
| Contexto perdido | Verificar memória |
|
||||
| RAG não encontra | Verificar embeddings |
|
||||
| Timeout | Aumentar limite |
|
||||
| Token limit | Resumir contexto |
|
||||
|
||||
---
|
||||
|
||||
*Skill v1.0 | Descomplicar®*
|
||||
92
automacao/skills/n8n-health/SKILL.md
Normal file
92
automacao/skills/n8n-health/SKILL.md
Normal file
@@ -0,0 +1,92 @@
|
||||
# /n8n-health - Diagnóstico n8n
|
||||
|
||||
Verificar conectividade e estado da instância n8n.
|
||||
|
||||
---
|
||||
|
||||
## Uso
|
||||
|
||||
```
|
||||
/n8n-health # Status rápido
|
||||
/n8n-health verbose # Diagnóstico completo
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Instância
|
||||
|
||||
| Aspecto | Valor |
|
||||
|---------|-------|
|
||||
| URL | `https://automator.descomplicar.pt` |
|
||||
| MCP | `mcp__n8n__*` |
|
||||
|
||||
---
|
||||
|
||||
## Execução
|
||||
|
||||
### Status Rápido (default)
|
||||
|
||||
```
|
||||
1. mcp__n8n__n8n_health_check({ mode: "status" })
|
||||
2. Reportar: status, URL, versão, response time
|
||||
```
|
||||
|
||||
### Diagnóstico Completo (verbose)
|
||||
|
||||
```
|
||||
1. mcp__n8n__n8n_health_check({ mode: "diagnostic", verbose: true })
|
||||
2. Reportar: env vars, tool status, cache, erros
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Output Esperado
|
||||
|
||||
```
|
||||
n8n Health Check
|
||||
----------------
|
||||
Status: OK | ERRO
|
||||
URL: https://automator.descomplicar.pt
|
||||
MCP: 2.33.x
|
||||
Response: XXXms
|
||||
Workflows: XX activos
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Se Falhar
|
||||
|
||||
| Erro | Causa | Solução |
|
||||
|------|-------|---------|
|
||||
| Connection refused | n8n offline | Verificar servidor |
|
||||
| 401 Unauthorized | API key inválida | Regenerar no n8n |
|
||||
| Timeout | Rede lenta | Verificar latência |
|
||||
|
||||
### Diagnóstico Manual
|
||||
|
||||
```bash
|
||||
# Verificar se n8n responde
|
||||
curl -I https://automator.descomplicar.pt
|
||||
|
||||
# Verificar API
|
||||
curl -H "X-N8N-API-KEY: $KEY" https://automator.descomplicar.pt/api/v1/workflows
|
||||
|
||||
# Logs MCP
|
||||
~/.claude/logs/mcp-n8n.log
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Skills Relacionadas
|
||||
|
||||
| Skill | Quando Usar |
|
||||
|-------|-------------|
|
||||
| `/n8n-webhook` | Criar webhooks |
|
||||
| `/n8n-schedule` | Automações cron |
|
||||
| `/n8n-sync` | Sincronização dados |
|
||||
| `/n8n-notify` | Alertas |
|
||||
| `/n8n-chatbot` | AI/Chatbots |
|
||||
|
||||
---
|
||||
|
||||
*Skill v1.0 | Descomplicar®*
|
||||
228
automacao/skills/n8n-notify/SKILL.md
Normal file
228
automacao/skills/n8n-notify/SKILL.md
Normal file
@@ -0,0 +1,228 @@
|
||||
# /n8n-notify - Notificações e Alertas n8n
|
||||
|
||||
Criar sistemas de alertas via Slack, email, SMS.
|
||||
|
||||
---
|
||||
|
||||
## Uso
|
||||
|
||||
```
|
||||
/n8n-notify create <descrição> # Criar sistema de alertas
|
||||
/n8n-notify slack <mensagem> # Quick Slack notification
|
||||
/n8n-notify email <para> <assunto> # Quick email
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Workflow Obrigatório
|
||||
|
||||
```
|
||||
1. Health check → mcp__n8n__n8n_health_check()
|
||||
2. Pesquisar template → mcp__n8n__search_templates({ query: "notification" })
|
||||
3. Se template OK → mcp__n8n__n8n_deploy_template()
|
||||
4. Se criar do zero → Seguir fluxo abaixo
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Canais Disponíveis
|
||||
|
||||
| Canal | Node | Uso |
|
||||
|-------|------|-----|
|
||||
| Slack | `nodes-base.slack` | Notificações equipa |
|
||||
| Email | `nodes-base.emailSend` | Alertas formais |
|
||||
| Telegram | `nodes-base.telegram` | Alertas mobile |
|
||||
| Discord | `nodes-base.discord` | Comunidades |
|
||||
| SMS | `nodes-base.twilio` | Alertas críticos |
|
||||
|
||||
---
|
||||
|
||||
## Slack
|
||||
|
||||
### Documentação
|
||||
|
||||
```javascript
|
||||
mcp__n8n__get_node({
|
||||
nodeType: "nodes-base.slack",
|
||||
detail: "standard",
|
||||
includeExamples: true
|
||||
})
|
||||
```
|
||||
|
||||
### Configuração
|
||||
|
||||
```javascript
|
||||
mcp__n8n__validate_node({
|
||||
nodeType: "nodes-base.slack",
|
||||
config: {
|
||||
resource: "message",
|
||||
operation: "post",
|
||||
channel: "#alertas",
|
||||
text: "Mensagem de alerta"
|
||||
},
|
||||
mode: "minimal"
|
||||
})
|
||||
```
|
||||
|
||||
### Mensagem Formatada (Blocks)
|
||||
|
||||
```javascript
|
||||
{
|
||||
blocksUi: {
|
||||
blocksValues: [
|
||||
{
|
||||
type: "header",
|
||||
text: { type: "plain_text", text: "Alerta" }
|
||||
},
|
||||
{
|
||||
type: "section",
|
||||
text: { type: "mrkdwn", text: "*Detalhes:*\n{{ $json.message }}" }
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Email
|
||||
|
||||
### Configuração
|
||||
|
||||
```javascript
|
||||
mcp__n8n__validate_node({
|
||||
nodeType: "nodes-base.emailSend",
|
||||
config: {
|
||||
fromEmail: "alertas@descomplicar.pt",
|
||||
toEmail: "emanuel@descomplicar.pt",
|
||||
subject: "Alerta: {{ $json.title }}",
|
||||
text: "{{ $json.message }}"
|
||||
},
|
||||
mode: "minimal"
|
||||
})
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Padrões Comuns
|
||||
|
||||
### Webhook → Slack
|
||||
|
||||
```
|
||||
Webhook (evento externo)
|
||||
↓
|
||||
Set (formatar)
|
||||
↓
|
||||
Slack (enviar)
|
||||
```
|
||||
|
||||
### Monitor → Multi-canal
|
||||
|
||||
```
|
||||
Schedule (cada 5min)
|
||||
↓
|
||||
HTTP Request (check health)
|
||||
↓
|
||||
IF (erro?)
|
||||
↓ TRUE
|
||||
Slack + Email (alertar)
|
||||
```
|
||||
|
||||
### Error Handler
|
||||
|
||||
```
|
||||
Qualquer workflow
|
||||
↓ (erro)
|
||||
Error Trigger
|
||||
↓
|
||||
Slack (alertar erro)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Níveis de Alerta
|
||||
|
||||
| Nível | Canal | Quando |
|
||||
|-------|-------|--------|
|
||||
| Info | Slack | Eventos normais |
|
||||
| Warning | Slack + Email | Atenção necessária |
|
||||
| Critical | Todos + SMS | Acção imediata |
|
||||
|
||||
### Implementação
|
||||
|
||||
```
|
||||
IF (severity = "critical")
|
||||
↓ TRUE
|
||||
Slack + Email + SMS
|
||||
↓ FALSE
|
||||
IF (severity = "warning")
|
||||
↓ TRUE
|
||||
Slack + Email
|
||||
↓ FALSE
|
||||
Slack
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Exemplos
|
||||
|
||||
### Alerta de Servidor Down
|
||||
|
||||
```
|
||||
Schedule (5min)
|
||||
↓
|
||||
HTTP Request (ping servidor)
|
||||
↓
|
||||
IF (falhou?)
|
||||
↓ TRUE
|
||||
Slack (#infra)
|
||||
Email (admin)
|
||||
```
|
||||
|
||||
### Novo Lead
|
||||
|
||||
```
|
||||
Webhook (lead criado)
|
||||
↓
|
||||
Set (formatar)
|
||||
↓
|
||||
Slack (#vendas)
|
||||
```
|
||||
|
||||
### Factura Vencida
|
||||
|
||||
```
|
||||
Schedule (diário 9h)
|
||||
↓
|
||||
HTTP Request (facturas vencidas)
|
||||
↓
|
||||
Loop (cada factura)
|
||||
↓
|
||||
Email (cliente)
|
||||
Slack (#contabilidade)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Templates
|
||||
|
||||
```javascript
|
||||
mcp__n8n__search_templates({
|
||||
searchMode: "keyword",
|
||||
query: "slack notification alert"
|
||||
})
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
| Problema | Solução |
|
||||
|----------|---------|
|
||||
| Slack não envia | Verificar token e canal |
|
||||
| Email em spam | Configurar SPF/DKIM |
|
||||
| Rate limited | Agrupar notificações |
|
||||
|
||||
---
|
||||
|
||||
*Skill v1.0 | Descomplicar®*
|
||||
163
automacao/skills/n8n-schedule/SKILL.md
Normal file
163
automacao/skills/n8n-schedule/SKILL.md
Normal file
@@ -0,0 +1,163 @@
|
||||
# /n8n-schedule - Automações Agendadas n8n
|
||||
|
||||
Criar workflows com execução agendada (cron).
|
||||
|
||||
---
|
||||
|
||||
## Uso
|
||||
|
||||
```
|
||||
/n8n-schedule create <descrição> # Criar automação agendada
|
||||
/n8n-schedule list # Listar agendamentos
|
||||
/n8n-schedule disable <id> # Desactivar
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Workflow Obrigatório
|
||||
|
||||
```
|
||||
1. Health check → mcp__n8n__n8n_health_check()
|
||||
2. Pesquisar template → mcp__n8n__search_templates({ task: "scheduling" })
|
||||
3. Se template OK → mcp__n8n__n8n_deploy_template()
|
||||
4. Se criar do zero → Seguir fluxo abaixo
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Expressões Cron Comuns
|
||||
|
||||
| Expressão | Descrição |
|
||||
|-----------|-----------|
|
||||
| `0 9 * * *` | Diário às 9h |
|
||||
| `0 9 * * 1-5` | Seg-Sex às 9h |
|
||||
| `0 */2 * * *` | A cada 2 horas |
|
||||
| `*/15 * * * *` | A cada 15 minutos |
|
||||
| `0 0 1 * *` | Dia 1 de cada mês |
|
||||
| `0 3 * * 0` | Domingos às 3h |
|
||||
|
||||
### Formato
|
||||
|
||||
```
|
||||
┌───────── minuto (0-59)
|
||||
│ ┌─────── hora (0-23)
|
||||
│ │ ┌───── dia mês (1-31)
|
||||
│ │ │ ┌─── mês (1-12)
|
||||
│ │ │ │ ┌─ dia semana (0-6)
|
||||
* * * * *
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Configuração Schedule Trigger
|
||||
|
||||
```javascript
|
||||
mcp__n8n__validate_node({
|
||||
nodeType: "nodes-base.scheduleTrigger",
|
||||
config: {
|
||||
rule: {
|
||||
interval: [{
|
||||
field: "cronExpression",
|
||||
expression: "0 9 * * 1-5"
|
||||
}]
|
||||
}
|
||||
},
|
||||
mode: "minimal"
|
||||
})
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Timezone
|
||||
|
||||
```javascript
|
||||
{
|
||||
options: {
|
||||
timezone: "Europe/Lisbon"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Exemplos
|
||||
|
||||
### Relatório Diário
|
||||
|
||||
```
|
||||
Schedule (0 9 * * 1-5)
|
||||
↓
|
||||
PostgreSQL (query)
|
||||
↓
|
||||
Set (formatar)
|
||||
↓
|
||||
Email (enviar)
|
||||
```
|
||||
|
||||
### Backup Semanal
|
||||
|
||||
```
|
||||
Schedule (0 3 * * 0)
|
||||
↓
|
||||
SSH (backup)
|
||||
↓
|
||||
IF (sucesso?)
|
||||
↓
|
||||
Slack (confirmar/alertar)
|
||||
```
|
||||
|
||||
### Limpeza de Logs
|
||||
|
||||
```
|
||||
Schedule (0 2 * * *)
|
||||
↓
|
||||
SSH (limpar)
|
||||
↓
|
||||
Slack (reportar)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Gestão
|
||||
|
||||
### Desactivar
|
||||
|
||||
```javascript
|
||||
mcp__n8n__n8n_update_partial_workflow({
|
||||
id: "wf-xxx",
|
||||
operations: [{ type: "deactivateWorkflow" }]
|
||||
})
|
||||
```
|
||||
|
||||
### Reactivar
|
||||
|
||||
```javascript
|
||||
mcp__n8n__n8n_update_partial_workflow({
|
||||
id: "wf-xxx",
|
||||
operations: [{ type: "activateWorkflow" }]
|
||||
})
|
||||
```
|
||||
|
||||
### Ver Execuções
|
||||
|
||||
```javascript
|
||||
mcp__n8n__n8n_executions({
|
||||
workflowId: "wf-xxx",
|
||||
limit: 10,
|
||||
status: "all"
|
||||
})
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
| Problema | Solução |
|
||||
|----------|---------|
|
||||
| Não executa | Verificar workflow activo |
|
||||
| Hora errada | Verificar timezone |
|
||||
| Duplicado | Verificar múltiplos triggers |
|
||||
|
||||
---
|
||||
|
||||
*Skill v1.0 | Descomplicar®*
|
||||
162
automacao/skills/n8n-sync/SKILL.md
Normal file
162
automacao/skills/n8n-sync/SKILL.md
Normal file
@@ -0,0 +1,162 @@
|
||||
# /n8n-sync - Sincronização de Dados n8n
|
||||
|
||||
Manter dados sincronizados entre sistemas.
|
||||
|
||||
---
|
||||
|
||||
## Uso
|
||||
|
||||
```
|
||||
/n8n-sync create <origem> <destino> # Criar sync
|
||||
/n8n-sync list # Listar syncs
|
||||
/n8n-sync status <workflow_id> # Ver estado
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Workflow Obrigatório
|
||||
|
||||
```
|
||||
1. Health check → mcp__n8n__n8n_health_check()
|
||||
2. Pesquisar template → mcp__n8n__search_templates({ task: "data_sync" })
|
||||
3. Se template OK → mcp__n8n__n8n_deploy_template()
|
||||
4. Se criar do zero → Seguir fluxo abaixo
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Padrões de Sync
|
||||
|
||||
### One-Way (Unidireccional)
|
||||
|
||||
```
|
||||
Origem → Transform → Destino
|
||||
```
|
||||
|
||||
### Two-Way (Bidireccional)
|
||||
|
||||
```
|
||||
A ←→ B (com resolução de conflitos)
|
||||
```
|
||||
|
||||
### Hub-and-Spoke
|
||||
|
||||
```
|
||||
A ↔ HUB ↔ B
|
||||
↕
|
||||
C
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Nodes por Sistema
|
||||
|
||||
### APIs/CRM
|
||||
|
||||
| Node | Sistema |
|
||||
|------|---------|
|
||||
| `nodes-base.httpRequest` | APIs genéricas |
|
||||
| `nodes-base.webhook` | Receber dados |
|
||||
|
||||
### Bases de Dados
|
||||
|
||||
| Node | Sistema |
|
||||
|------|---------|
|
||||
| `nodes-base.postgres` | PostgreSQL |
|
||||
| `nodes-base.mySql` | MySQL |
|
||||
| `nodes-base.mongoDb` | MongoDB |
|
||||
|
||||
### Ficheiros
|
||||
|
||||
| Node | Sistema |
|
||||
|------|---------|
|
||||
| `nodes-base.googleSheets` | Google Sheets |
|
||||
| `nodes-base.spreadsheetFile` | Excel/CSV |
|
||||
| `nodes-base.ftp` | FTP/SFTP |
|
||||
|
||||
---
|
||||
|
||||
## Exemplo: CRM → Sheets
|
||||
|
||||
```
|
||||
Schedule (horário)
|
||||
↓
|
||||
HTTP Request (GET leads)
|
||||
↓
|
||||
IF (há dados?)
|
||||
↓
|
||||
Set (mapear campos)
|
||||
↓
|
||||
Google Sheets (append)
|
||||
↓
|
||||
Slack (confirmar)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Estratégias
|
||||
|
||||
| Estratégia | Uso |
|
||||
|------------|-----|
|
||||
| Full Sync | Apagar tudo + inserir tudo |
|
||||
| Incremental | Apenas modificados (updated_at) |
|
||||
| Delta | Comparar hashes |
|
||||
|
||||
---
|
||||
|
||||
## Upsert Pattern
|
||||
|
||||
```javascript
|
||||
{
|
||||
nodeType: "nodes-base.postgres",
|
||||
config: {
|
||||
operation: "upsert",
|
||||
table: "clientes",
|
||||
columns: "email,nome,empresa",
|
||||
conflictColumns: "email"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Gestão de Erros
|
||||
|
||||
### Retry
|
||||
|
||||
```javascript
|
||||
{
|
||||
options: {
|
||||
retry: {
|
||||
maxRetries: 3,
|
||||
retryInterval: 1000
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Dead Letter Queue
|
||||
|
||||
```
|
||||
Operação
|
||||
↓ (erro)
|
||||
Error Trigger
|
||||
↓
|
||||
BD (guardar erro)
|
||||
↓
|
||||
Slack (alertar)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
| Problema | Solução |
|
||||
|----------|---------|
|
||||
| Duplicados | Usar upsert |
|
||||
| Timeout | Batches menores |
|
||||
| Rate limit | Adicionar delays |
|
||||
|
||||
---
|
||||
|
||||
*Skill v1.0 | Descomplicar®*
|
||||
155
automacao/skills/n8n-webhook/SKILL.md
Normal file
155
automacao/skills/n8n-webhook/SKILL.md
Normal file
@@ -0,0 +1,155 @@
|
||||
# /n8n-webhook - Webhooks n8n
|
||||
|
||||
Criar e gerir webhooks para receber dados externos.
|
||||
|
||||
---
|
||||
|
||||
## Uso
|
||||
|
||||
```
|
||||
/n8n-webhook create <descrição> # Criar novo webhook
|
||||
/n8n-webhook list # Listar webhooks existentes
|
||||
/n8n-webhook test <workflow_id> # Testar webhook
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Workflow Obrigatório
|
||||
|
||||
```
|
||||
1. Health check → mcp__n8n__n8n_health_check()
|
||||
2. Pesquisar template → mcp__n8n__search_templates({ query: "webhook" })
|
||||
3. Se template OK → mcp__n8n__n8n_deploy_template()
|
||||
4. Se criar do zero → Seguir fluxo abaixo
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Criar Webhook do Zero
|
||||
|
||||
### Passo 1: Documentação do Node
|
||||
|
||||
```javascript
|
||||
mcp__n8n__get_node({
|
||||
nodeType: "nodes-base.webhook",
|
||||
detail: "standard",
|
||||
includeExamples: true
|
||||
})
|
||||
```
|
||||
|
||||
### Passo 2: Validar Configuração
|
||||
|
||||
```javascript
|
||||
mcp__n8n__validate_node({
|
||||
nodeType: "nodes-base.webhook",
|
||||
config: {
|
||||
httpMethod: "POST",
|
||||
path: "meu-webhook",
|
||||
responseMode: "onReceived"
|
||||
},
|
||||
mode: "minimal"
|
||||
})
|
||||
```
|
||||
|
||||
### Passo 3: Nodes de Processamento
|
||||
|
||||
| Node | Uso |
|
||||
|------|-----|
|
||||
| `nodes-base.set` | Transformar dados |
|
||||
| `nodes-base.if` | Condicionais |
|
||||
| `nodes-base.code` | JavaScript custom |
|
||||
| `nodes-base.httpRequest` | Chamar APIs |
|
||||
|
||||
### Passo 4: Deploy
|
||||
|
||||
```javascript
|
||||
mcp__n8n__n8n_create_workflow({
|
||||
name: "Webhook - Descrição",
|
||||
nodes: [...],
|
||||
connections: {...},
|
||||
active: true
|
||||
})
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Configurações Webhook
|
||||
|
||||
| Parâmetro | Opções | Default |
|
||||
|-----------|--------|---------|
|
||||
| `httpMethod` | GET, POST, PUT, DELETE | POST |
|
||||
| `path` | String única | (obrigatório) |
|
||||
| `authentication` | none, basicAuth, headerAuth | none |
|
||||
| `responseMode` | onReceived, lastNode | onReceived |
|
||||
|
||||
---
|
||||
|
||||
## URL do Webhook
|
||||
|
||||
Após deploy:
|
||||
```
|
||||
https://automator.descomplicar.pt/webhook/<path>
|
||||
```
|
||||
|
||||
Modo teste (workflow inactivo):
|
||||
```
|
||||
https://automator.descomplicar.pt/webhook-test/<path>
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Exemplos
|
||||
|
||||
### Webhook → Slack
|
||||
|
||||
```
|
||||
Webhook (POST /notify)
|
||||
↓
|
||||
Set (formatar)
|
||||
↓
|
||||
Slack (enviar)
|
||||
```
|
||||
|
||||
### Webhook → CRM
|
||||
|
||||
```
|
||||
Webhook (POST /lead)
|
||||
↓
|
||||
HTTP Request (criar no Desk)
|
||||
↓
|
||||
Email (notificar)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Testar
|
||||
|
||||
```javascript
|
||||
mcp__n8n__n8n_test_workflow({
|
||||
workflowId: "wf-xxx",
|
||||
inputData: {
|
||||
body: { "test": "data" },
|
||||
headers: { "Content-Type": "application/json" }
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
```bash
|
||||
curl -X POST https://automator.descomplicar.pt/webhook/meu-webhook \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"test": "data"}'
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
| Problema | Solução |
|
||||
|----------|---------|
|
||||
| 404 Not Found | Workflow não está activo |
|
||||
| 401 Unauthorized | Verificar autenticação |
|
||||
| Dados não chegam | Verificar responseMode |
|
||||
|
||||
---
|
||||
|
||||
*Skill v1.0 | Descomplicar®*
|
||||
Reference in New Issue
Block a user