ecom-store/workflows/m5-twenty-to-openwa.json
Iris Florencio 0a0061a914 feat(workflows): fase 5 — integração WhatsApp (OpenWA) ↔ Twenty CRM
Work feito nesta sessão:
- Traefik routes.yml: crm.m5digital.net.br → twenty-crm (Twenty substitui Hermes CRM)
- Backup pre-fase3 salvo em /root/backups/2026-07-06_pre-crm-reorg/
- 3 IPs hardcoded substituídos por container names (video, chatwoot, twenty)
- API key OpenWA recuperada do .api-key (regenerada em 29/jun/2026)
- Workflows n8n JSON prontos para WhatsApp → CRM e CRM → WhatsApp
- Documentação completa em workflows/README-FASE5-OPENWA-TWENTY.md

Pendência: import manual dos workflows via n8n UI após login wizard.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-06 16:49:26 -03:00

102 lines
2.8 KiB
JSON

{
"name": "M5 — Twenty CRM → OpenWA (resposta)",
"description": "Recebe evento do Twenty CRM (note/activity criada) e envia mensagem WhatsApp via OpenWA",
"active": true,
"nodes": [
{
"id": "webhook-in",
"name": "Webhook Twenty",
"type": "n8n-nodes-base.webhook",
"typeVersion": 1,
"position": [240, 300],
"webhookId": "m5-twenty-out",
"parameters": {
"httpMethod": "POST",
"path": "twenty-outgoing",
"responseMode": "responseNode",
"options": {"authentication": "none"}
}
},
{
"id": "extract",
"name": "Extrai Telefone + Texto",
"type": "n8n-nodes-base.set",
"typeVersion": 1,
"position": [460, 300],
"parameters": {
"values": {
"string": [
{"name": "sessionId", "value": "marcos-pessoal"},
{"name": "phone", "value": "={{$jsonBody.person.phone.replace(/\\D/g, '')}}"},
{"name": "message", "value": "={{$jsonBody.note.body}}"}
]
}
}
},
{
"id": "http-openwa",
"name": "OpenWA: send-text",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 3,
"position": [680, 300],
"parameters": {
"method": "POST",
"url": "=https://wa.m5digital.net.br/api/sessions/{{$json.sessionId}}/messages/send-text",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{"name": "X-API-Key", "value": "owa_k1_1e56b98c39a2daa5bdb537d04f35da17117021bedc8c1de80eaba2926c584b39"}
]
},
"sendBody": true,
"contentType": "json",
"body": {
"phone": "={{$json.phone}}",
"text": "={{$json.message}}"
},
"options": {
"timeout": 15000
}
}
},
{
"id": "respond",
"name": "Respond Twenty",
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1,
"position": [900, 300],
"parameters": {
"respondWith": "json",
"responseBody": "={{ { status: 'sent' } }}"
}
}
],
"connections": {
"webhook-in": {
"main": [[{"node": "extract", "type": "main", "index": 0}]]
},
"extract": {
"main": [[{"node": "http-openwa", "type": "main", "index": 0}]]
},
"http-openwa": {
"main": [[{"node": "respond", "type": "main", "index": 0}]]
}
},
"settings": {
"saveExecutionProgress": true,
"saveManualExecutions": true,
"callerPolicy": "workflowsFromSameOwner"
},
"versionId": "m5-twenty-openwa-v1",
"triggerCount": 0,
"tags": [
{"name": "m5"},
{"name": "openwa"},
{"name": "twenty-crm"},
{"name": "whatsapp"}
],
"meta": {"description": "CRM → WhatsApp"}
}