Flusso n8n per Raccolta e Trascrizione Chiamate
Guida al flusso n8n che raccoglie, scarica, analizza e trascrive le chiamate effettuate dal CRM Squadd
Questa guida ti mostrerà come funziona il flusso n8n per la raccolta e trascrizione automatica delle chiamate effettuate tramite Squadd.
Come funziona
Il flusso n8n si collega a Squadd tramite webhook. Per ogni chiamata effettuata dal CRM:
- Raccolta — Il webhook riceve i dati della chiamata
- Download — Il flusso scarica la registrazione audio
- Analisi — Vengono estratte le informazioni rilevanti
- Trascrizione — L'audio viene convertito in testo
Automazione su Squadd
Trigger
Call Details
Wait
0,1 minuti (6 secondi) di attesa per dare il tempo al CRM di processare la chiamata
Webhook:
Metodo: POST/GET (indifferente - dipende da come imposti il webhook su n8n, in questo caso è GET)
URL: url fornito da n8n
contactName: {{contact.name}} contactPhone: {{contact.phone}} contactEmail: {{contact.email}} callStatus: {{call.status}} chiamante: {{phoneCall.user.name}} durata: {{phoneCall.duration}} status: {{phoneCall.callStatus}} startTime: {{phoneCall.startTime}} contactID: {{contact.id}} attachment: {{message.attachments}}
Headers
Content-Type : application/json

Flusso n8n in JSON
Copia l’intero flusso JSON in un flusso n8n vuoto
{
"name": "Ricevi chiamate da Squadd e trascrivi",
"nodes": [
{
"parameters": {
"path": "9b73f8bc-d6e3-498c-87dd-061e4b6957b1",
"options": {}
},
"type": "n8n-nodes-base.webhook",
"typeVersion": 2,
"position": [
208,
-192
],
"id": "7204fe17-812b-46df-802e-c1b74bc3679b",
"name": "Webhook",
"webhookId": "9b73f8bc-d6e3-498c-87dd-061e4b6957b1"
},
{
"parameters": {
"content": "## Spiegazione flusso\nSe hai bisogno di più informazioni, consulta questa guida veloce per i passaggi essenziali:\n\n",
"height": 192,
"width": 304
},
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
144,
-416
],
"id": "404ce293-0461-40f7-8028-cb61990e9d41",
"name": "Sticky Note"
},
{
"parameters": {
"url": "https://services.leadconnectorhq.com/conversations/search",
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "locationId",
"value": "DfxGoORmPoL5Z1OcfYJM"
},
{
"name": "contactId",
"value": "={{ $('Webhook').item.json.query.contactID }}"
}
]
},
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "Accept",
"value": "application/json"
},
{
"name": "Authorization",
"value": "Bearer pit-[tua_chiave_API]"
},
{
"name": "Version",
"value": "2021-04-15"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
1104,
-192
],
"id": "07ed29f5-39c2-4d59-b626-abc2b03b0a56",
"name": "Search Conversations"
},
{
"parameters": {
"url": "=https://services.leadconnectorhq.com/conversations/{{ $json.conversations[0].id }}/messages",
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "limit",
"value": "1"
},
{
"name": "type",
"value": "TYPE_CALL"
}
]
},
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "Accept",
"value": "application/json"
},
{
"name": "Authorization",
"value": "Bearer pit-[tua_chiave_API]"
},
{
"name": "Version",
"value": "2021-04-15"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
1328,
-192
],
"id": "6b9e6cad-f8fe-40ae-982f-725fb4858897",
"name": "Get messages by conversation id"
},
{
"parameters": {
"resource": "audio",
"operation": "transcribe",
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.openAi",
"typeVersion": 1.8,
"position": [
1776,
-192
],
"id": "b7e8f96c-3996-4030-9500-3db297733a9e",
"name": "Transcribe a recording",
"credentials": {
"openAiApi": {
"id": "iWg0FCxNtSWeMoI9",
"name": "OpenAi account"
}
}
},
{
"parameters": {
"jsCode": "// Legge i secondi dal nodo \"Webhook\" e produce 1 item con durata_hms\nconst raw = $('Webhook').first().json.query?.durata;\nconst n = Number(String(raw ?? '').trim().replace(',', '.'));\n\nif (!Number.isFinite(n)) {\n return [{ json: { error: 'durata non valida', raw } }];\n}\n\nconst secs = Math.trunc(n);\nconst sign = secs < 0 ? '-' : '';\nconst abs = Math.abs(secs);\n\nconst h = Math.floor(abs / 3600);\nconst m = Math.floor((abs % 3600) / 60);\nconst s = abs % 60;\n\nconst parts = [];\nif (h) parts.push(`${h}h`);\nif (h || m) parts.push(`${m}m`);\nparts.push(`${s}s`);\n\nreturn [{\n json: {\n durata_seconds: secs,\n durata_hms: sign + parts.join(' ')\n }\n}];\n"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
880,
-192
],
"id": "ad9ac327-63a7-4d44-9c3a-503681509fee",
"name": "Code"
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "881c7bfa-9e49-45b6-9ffd-2821b78a2faf",
"leftValue": "={{ $json.query.durata }}",
"rightValue": 59,
"operator": {
"type": "number",
"operation": "gt"
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.2,
"position": [
656,
-192
],
"id": "1e295863-53d2-49d4-a634-6fb13426ddae",
"name": "If"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "f95e9e2a-170a-4d4b-92f6-e186ab0f0de0",
"name": "query.durata",
"value": "={{ $json.query.durata }}",
"type": "number"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
432,
-192
],
"id": "cff1ce3f-f927-49f2-a8b8-38431b886ee2",
"name": "Edit Fields"
},
{
"parameters": {
"url": "=https://services.leadconnectorhq.com/conversations/messages/{{ $json.messages.lastMessageId }}/locations/DfxGoORmPoL5Z1OcfYJM/recording",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "Accept",
"value": "application/json"
},
{
"name": "Authorization",
"value": "Bearer pit-[tua_chiave_API]"
},
{
"name": "Version",
"value": "2021-04-15"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
1552,
-192
],
"id": "f64d13ce-220e-44c7-afd2-8e7b3f32e8d4",
"name": "Scarica l'audio"
},
{
"parameters": {
"jsCode": "let t = $input.first().json.text || $json.TRANSCRIPT || '';\n// normalizza spazi\nt = t.replace(/\\s+/g, ' ').trim();\n\n// 1) SEPARA Q→A tipiche (identificazione): \"? Sono io.\" / \"? Sì.\"\nt = t.replace(/\\?\\s*(Sono io\\.|Sì\\.?|Pronto\\.?)/gi, (m, ans) => `?\\n${ans}`);\n\n// 2) Spezza su punteggiatura forte + maiuscola (euristica robusta per telefonate)\nt = t.replace(/([?!\\.])\\s+(?=[A-ZÀ-Ý])/g, '$1\\n');\n\n// 3) Se una riga è molto lunga, spezza su virgole (massimo ~240 caratteri)\nconst maxLen = 240;\nlet units = t.split('\\n').map(s => s.trim()).filter(Boolean).flatMap(s => {\n if (s.length <= maxLen) return [s];\n const parts = s.split(/,\\s+/);\n const out = [];\n let buf = '';\n for (const p of parts) {\n const cand = buf ? (buf + ', ' + p) : p;\n if (cand.length > maxLen) {\n if (buf) out.push(buf);\n buf = p;\n } else {\n buf = cand;\n }\n }\n if (buf) out.push(buf);\n return out;\n});\n\n// 4) compatta backchannel ripetuti in una sola riga\nunits = units.map(s => s.replace(/\\b(sì|ok|mh|mmh|ehm)(,\\s*\\1)+\\b/gi, '$1'));\n\n// salva\n$json.LINES = units;\nreturn $json;\n"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
2016,
-192
],
"id": "3c8e0ed1-4e71-490c-80e3-d8627ee58e20",
"name": "Split Text"
},
{
"parameters": {
"jsCode": "// Get the first item\nconst item = $input.first() ?? { json: {} };\n\n// Helper: coerce any value to plain text\nfunction toText(v) {\n if (v == null) return '';\n if (Array.isArray(v)) return v.flat(Infinity).map(toText).join(' ');\n if (typeof v === 'object') return ''; // don't count object dumps\n return String(v);\n}\n\n// Source text (expects json.text, but tolerates arrays/numbers/etc.)\nconst raw = toText(item.json.text);\n\n// Normalize whitespace and zero-width chars\nconst normalized = raw.replace(/\\u200B/g, '').trim().replace(/\\s+/g, ' ');\n\n// Count words deterministically\nconst wordCount = normalized.length ? normalized.split(' ').length : 0;\n\n// Return, preserving original fields and adding a numeric field\nreturn [\n {\n json: {\n ...item.json,\n wordCount,\n wordCountNum: Number(wordCount)\n }\n }\n];\n"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
2208,
-192
],
"id": "f7a6f147-96cb-4efe-af55-58b0ba815066",
"name": "Word Count"
},
{
"parameters": {
"content": "## Passaggi opzionali per trascrizione e pulizia del trascritto",
"height": 272,
"width": 672
},
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
1712,
-288
],
"id": "d1bf21e2-9dd2-4b0a-ad0f-4ef81aff7283",
"name": "Sticky Note1"
}
],
"pinData": {
"Webhook": [
{
"json": {
"headers": {
"host": "n8n.srv938822.hstgr.cloud",
"user-agent": "axios/1.7.7",
"accept": "application/json, text/plain, */*",
"accept-encoding": "gzip, compress, deflate, br",
"content-type": "application/json",
"x-forwarded-for": "34.30.119.249",
"x-forwarded-host": "n8n.srv938822.hstgr.cloud",
"x-forwarded-port": "443",
"x-forwarded-proto": "https",
"x-forwarded-server": "649b5453fb19",
"x-real-ip": "34.30.119.249"
},
"params": {},
"query": {
"contactName": "Alessio Bronzi",
"contactPhone": "351 720 6220",
"contactEmail": "alessio.bronzi92@gmail.com",
"callStatus": "",
"chiamante": "Daniele Garofalo",
"durata": "377",
"status": "completed",
"startTime": "2025-08-31 16:08:39",
"contactID": "LqJJHhywulLV0TfZ8hKZ",
"attachment": "https://api.twilio.com/2010-04-01/Accounts/AC0df2799a41f3bb35fbda570d2c8413a1/Recordings/RE842302ee2c9f642db00fd7c6e06c863a"
},
"body": {},
"webhookUrl": "https://n8n.srv938822.hstgr.cloud/webhook/24fea120-6886-47e6-aaaf-3149bdb51d1c",
"executionMode": "production"
}
}
]
},
"connections": {
"Webhook": {
"main": [
[
{
"node": "Edit Fields",
"type": "main",
"index": 0
}
]
]
},
"Search Conversations": {
"main": [
[
{
"node": "Get messages by conversation id",
"type": "main",
"index": 0
}
]
]
},
"Get messages by conversation id": {
"main": [
[
{
"node": "Scarica l'audio",
"type": "main",
"index": 0
}
]
]
},
"Transcribe a recording": {
"main": [
[
{
"node": "Split Text",
"type": "main",
"index": 0
}
]
]
},
"Code": {
"main": [
[
{
"node": "Search Conversations",
"type": "main",
"index": 0
}
]
]
},
"If": {
"main": [
[
{
"node": "Code",
"type": "main",
"index": 0
}
]
]
},
"Edit Fields": {
"main": [
[
{
"node": "If",
"type": "main",
"index": 0
}
]
]
},
"Scarica l'audio": {
"main": [
[
{
"node": "Transcribe a recording",
"type": "main",
"index": 0
}
]
]
},
"Split Text": {
"main": [
[
{
"node": "Word Count",
"type": "main",
"index": 0
}
]
]
},
"Word Count": {
"main": [
[]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "e125a43f-6c1a-4086-b999-7318b3d6f670",
"meta": {
"templateCredsSetupCompleted": true,
"instanceId": "69d81c34d7a418ff378940fc88ab52329559bab462c0406924dbb688f65c836b"
},
"id": "InoXleKFB4iCNUi3",
"tags": []
}L'assistenza non potrà fornire aiuto su questi flussi e casistiche; queste guide sono fatte dai nostri tecnici internamente e richiedono un livello avanzato di conoscenza della materia.
Ultimo aggiornamento il December 16, 2025