{ "kind": "open-flow-workflow", "version": 1, "name": "Website Lead Capture", "content": { "modelVersion": 14, "document": { "bindings": {}, "graph": { "nodes": { "n_8f44f370a2f87c92": { "name": "New website lead", "kind": "webhook", "bodyFields": [ { "jsonSchema": {}, "nullable": true, "handle": "nome" }, { "jsonSchema": {}, "nullable": true, "handle": "name" }, { "jsonSchema": {}, "nullable": true, "handle": "email" }, { "jsonSchema": {}, "nullable": true, "handle": "telefono" }, { "jsonSchema": {}, "nullable": true, "handle": "phone" }, { "jsonSchema": {}, "nullable": true, "handle": "messaggio" }, { "jsonSchema": {}, "nullable": true, "handle": "message" } ], "method": "POST", "options": { "responseData": "{\"message\":\"Workflow was started\"}", "responseHeaders": { "content-type": "application/json" }, "responseStatusCode": 200 } }, "n_b92439bcdb60c88d": { "inputs": { "body": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_8f44f370a2f87c92", "output": "body" } ] }, "timezone": { "kind": "value", "value": "UTC" }, "signature": { "kind": "value", "value": "[IL TUO NOME / AZIENDA]" } }, "name": "Prepare lead", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "object" }, "nullable": false, "handle": "body" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "timezone" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "signature" } ], "outputs": [ { "jsonSchema": { "type": "object" }, "nullable": false, "handle": "lead" }, { "jsonSchema": { "type": "array", "items": { "type": "array", "items": { "anyOf": [ { "type": "string" }, { "type": "number" }, { "type": "boolean" }, { "type": "null" } ], "description": "Google Sheets cell value." } }, "description": "Two-dimensional cell value matrix.", "minItems": 1 }, "nullable": false, "handle": "values" }, { "jsonSchema": { "type": "string", "minLength": 1, "maxLength": 4096, "description": "The text of the message to send." }, "nullable": false, "handle": "alert" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "email" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "reply" } ], "name": "Prepare lead", "moduleId": "n_f77c2de5f64faa60", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_88a70f4fb00187e6": { "inputs": { "spreadsheetId": { "kind": "value", "value": "YOUR_SPREADSHEET_ID" }, "range": { "kind": "value", "value": "'Lead'!A:F" }, "values": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_b92439bcdb60c88d", "output": "values" } ] }, "valueInputOption": { "kind": "value", "value": "RAW" }, "insertDataOption": { "kind": "value", "value": "INSERT_ROWS" } }, "name": "Save lead", "kind": "task", "task": { "inputs": [ { "description": "Google Sheets spreadsheet ID or spreadsheet URL.", "jsonSchema": { "type": "string", "minLength": 1, "description": "Google Sheets spreadsheet ID or spreadsheet URL." }, "nullable": false, "handle": "spreadsheetId" }, { "description": "A1 notation range.", "jsonSchema": { "type": "string", "minLength": 1, "description": "A1 notation range." }, "nullable": false, "handle": "range" }, { "description": "Two-dimensional cell value matrix.", "jsonSchema": { "type": "array", "items": { "type": "array", "items": { "anyOf": [ { "type": "string" }, { "type": "number" }, { "type": "boolean" }, { "type": "null" } ], "description": "Google Sheets cell value." } }, "description": "Two-dimensional cell value matrix.", "minItems": 1 }, "nullable": false, "handle": "values" }, { "description": "Major dimension for value ranges.", "jsonSchema": { "type": "string", "enum": [ "DIMENSION_UNSPECIFIED", "ROWS", "COLUMNS" ], "description": "Major dimension for value ranges." }, "nullable": true, "handle": "majorDimension", "value": null }, { "description": "How appended data should be inserted.", "jsonSchema": { "type": "string", "enum": [ "OVERWRITE", "INSERT_ROWS" ], "description": "How appended data should be inserted." }, "nullable": true, "handle": "insertDataOption", "value": null }, { "description": "How input data should be interpreted.", "jsonSchema": { "type": "string", "enum": [ "INPUT_VALUE_OPTION_UNSPECIFIED", "RAW", "USER_ENTERED" ], "description": "How input data should be interpreted." }, "nullable": false, "handle": "valueInputOption" }, { "description": "Whether to include written values in the response.", "jsonSchema": { "type": "boolean", "description": "Whether to include written values in the response." }, "nullable": true, "handle": "includeValuesInResponse", "value": null }, { "description": "How values should be rendered.", "jsonSchema": { "type": "string", "enum": [ "FORMATTED_VALUE", "UNFORMATTED_VALUE", "FORMULA" ], "description": "How values should be rendered." }, "nullable": true, "handle": "responseValueRenderOption", "value": null }, { "description": "How dates and times should be rendered.", "jsonSchema": { "type": "string", "enum": [ "SERIAL_NUMBER", "FORMATTED_STRING" ], "description": "How dates and times should be rendered." }, "nullable": true, "handle": "responseDateTimeRenderOption", "value": null } ], "outputs": [ { "description": "Spreadsheet ID.", "jsonSchema": { "type": "string", "description": "Spreadsheet ID." }, "nullable": false, "handle": "spreadsheetId" }, { "description": "Updated A1 range.", "jsonSchema": { "type": "string", "description": "Updated A1 range." }, "nullable": false, "handle": "updatedRange" }, { "description": "Number of updated rows.", "jsonSchema": { "type": "integer", "description": "Number of updated rows." }, "nullable": false, "handle": "updatedRows" }, { "description": "Number of updated columns.", "jsonSchema": { "type": "integer", "description": "Number of updated columns." }, "nullable": false, "handle": "updatedColumns" }, { "description": "Number of updated cells.", "jsonSchema": { "type": "integer", "description": "Number of updated cells." }, "nullable": false, "handle": "updatedCells" }, { "description": "Google Sheets ValueRange.", "jsonSchema": { "type": "object", "properties": { "range": { "type": "string", "description": "A1 notation range returned by Google." }, "majorDimension": { "type": "string", "description": "Major dimension returned by Google." }, "values": { "type": "array", "items": { "type": "array", "items": { "anyOf": [ { "type": "string" }, { "type": "number" }, { "type": "boolean" }, { "type": "null" } ], "description": "Google Sheets cell value." } }, "description": "Cell values." } }, "additionalProperties": false, "required": [ "range", "majorDimension", "values" ], "description": "Google Sheets ValueRange." }, "nullable": true, "handle": "updatedData" }, { "description": "Table range before append.", "jsonSchema": { "type": "string", "description": "Table range before append." }, "nullable": false, "handle": "tableRange" } ], "name": "Save lead", "executor": { "kind": "connector", "action": "googlesheets.spreadsheets_values_append" } } }, "n_17b0ba69014b56c5": { "inputs": { "chatId": { "kind": "value", "value": "@YOUR_TELEGRAM_CHANNEL" }, "text": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_b92439bcdb60c88d", "output": "alert" } ] }, "parseMode": { "kind": "value", "value": "Markdown" } }, "name": "Notify team", "kind": "task", "task": { "inputs": [ { "description": "The target Telegram chat ID or channel username.", "jsonSchema": { "anyOf": [ { "type": "integer", "description": "A numeric Telegram chat identifier." }, { "type": "string", "pattern": "^-?\\d+$", "description": "A numeric Telegram chat identifier encoded as a string." }, { "type": "string", "pattern": "^@[A-Za-z0-9_]+$", "description": "A Telegram @username for a public chat or channel." } ], "description": "The target Telegram chat ID or channel username." }, "nullable": false, "handle": "chatId" }, { "description": "The text of the message to send.", "jsonSchema": { "type": "string", "minLength": 1, "maxLength": 4096, "description": "The text of the message to send." }, "nullable": false, "handle": "text" }, { "description": "The unique identifier of the Telegram business connection.", "jsonSchema": { "type": "string", "minLength": 1, "description": "The unique identifier of the Telegram business connection." }, "nullable": true, "handle": "businessConnectionId", "value": null }, { "description": "The parse mode used for message entities.", "jsonSchema": { "type": "string", "enum": [ "Markdown", "MarkdownV2", "HTML" ], "description": "The parse mode used for message entities." }, "nullable": true, "handle": "parseMode", "value": null }, { "description": "Whether to send the message silently.", "jsonSchema": { "type": "boolean", "description": "Whether to send the message silently." }, "nullable": true, "handle": "disableNotification", "value": null }, { "description": "Whether to protect the sent message from forwarding and saving.", "jsonSchema": { "type": "boolean", "description": "Whether to protect the sent message from forwarding and saving." }, "nullable": true, "handle": "protectContent", "value": null }, { "description": "Whether to disable link previews in the message.", "jsonSchema": { "type": "boolean", "description": "Whether to disable link previews in the message." }, "nullable": true, "handle": "disableWebPagePreview", "value": null }, { "description": "The forum topic ID for the target message thread.", "jsonSchema": { "type": "integer", "minimum": 1, "description": "The forum topic ID for the target message thread." }, "nullable": true, "handle": "messageThreadId", "value": null }, { "description": "The message ID to reply to.", "jsonSchema": { "type": "integer", "minimum": 1, "description": "The message ID to reply to." }, "nullable": true, "handle": "replyToMessageId", "value": null } ], "outputs": [ { "description": "A normalized Telegram message record.", "jsonSchema": { "type": "object", "properties": {}, "additionalProperties": true, "description": "A normalized Telegram message record." }, "nullable": false, "handle": "output" } ], "name": "Notify team", "executor": { "kind": "connector", "action": "telegram.send_message", "outputMode": "value" } } }, "n_aea4759d2f661bdc": { "inputs": { "to": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_b92439bcdb60c88d", "output": "email" } ] }, "subject": { "kind": "value", "value": "Abbiamo ricevuto la tua richiesta โœ”" }, "body": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_b92439bcdb60c88d", "output": "reply" } ] }, "isHtml": { "kind": "value", "value": false } }, "name": "Acknowledge enquiry", "kind": "task", "task": { "inputs": [ { "description": "Primary recipient email address.", "jsonSchema": { "type": "string", "description": "Primary recipient email address." }, "nullable": true, "handle": "recipientEmail", "value": null }, { "description": "Primary recipient email address.", "jsonSchema": { "type": "string", "description": "Primary recipient email address." }, "nullable": true, "handle": "to", "value": null }, { "description": "Additional To recipients.", "jsonSchema": { "type": "array", "items": { "type": "string" }, "description": "Additional To recipients." }, "nullable": true, "handle": "extraRecipients", "value": null }, { "description": "Cc recipients.", "jsonSchema": { "anyOf": [ { "type": "string" }, { "type": "array", "items": { "type": "string" } } ], "description": "Cc recipients." }, "nullable": true, "handle": "cc", "value": null }, { "description": "Bcc recipients.", "jsonSchema": { "anyOf": [ { "type": "string" }, { "type": "array", "items": { "type": "string" } } ], "description": "Bcc recipients." }, "nullable": true, "handle": "bcc", "value": null }, { "description": "Email subject line.", "jsonSchema": { "type": "string", "description": "Email subject line." }, "nullable": true, "handle": "subject", "value": null }, { "description": "Email body content.", "jsonSchema": { "type": "string", "description": "Email body content." }, "nullable": true, "handle": "body", "value": null }, { "description": "Reply or draft body content.", "jsonSchema": { "type": "string", "description": "Reply or draft body content." }, "nullable": true, "handle": "messageBody", "value": null }, { "description": "Whether the body is HTML.", "jsonSchema": { "type": "boolean", "description": "Whether the body is HTML." }, "nullable": true, "handle": "isHtml", "value": null }, { "description": "Verified Gmail send-as alias.", "jsonSchema": { "type": "string", "description": "Verified Gmail send-as alias." }, "nullable": true, "handle": "fromEmail", "value": null } ], "outputs": [ { "description": "Gmail message ID.", "jsonSchema": { "type": "string", "minLength": 1, "description": "Gmail message ID." }, "nullable": false, "handle": "messageId" } ], "name": "Acknowledge enquiry", "executor": { "kind": "connector", "action": "gmail.send_email" } } } }, "edges": [ { "source": "n_8f44f370a2f87c92", "target": "n_b92439bcdb60c88d" }, { "source": "n_b92439bcdb60c88d", "target": "n_88a70f4fb00187e6" }, { "source": "n_88a70f4fb00187e6", "target": "n_17b0ba69014b56c5" }, { "source": "n_17b0ba69014b56c5", "target": "n_aea4759d2f661bdc" } ] } }, "modules": { "n_f77c2de5f64faa60": { "name": "Prepare lead", "imports": [], "source": "export default ({ body, timezone, signature }) => {\n if (!/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(String(body.email || ''))) {\n throw new Error('A valid lead email is required before saving or notifying.');\n }\n const escapeMarkdown = (text) => text\n .replace(/([\\\\_*[\\]])/g, '\\\\$1')\n .replaceAll(String.fromCharCode(96), '\\\\' + String.fromCharCode(96));\n const parts = Object.fromEntries(\n new Intl.DateTimeFormat('en-GB', {\n timeZone: timezone, day: '2-digit', month: '2-digit', year: 'numeric',\n hour: '2-digit', minute: '2-digit', hourCycle: 'h23',\n }).formatToParts(new Date()).map((part) => [part.type, part.value]),\n );\n const lead = {\n nome: String(body.nome || body.name || 'Non indicato'),\n email: String(body.email || ''),\n telefono: String(body.telefono || body.phone || 'Non indicato'),\n messaggio: String(body.messaggio || body.message || ''),\n data: parts.day + '/' + parts.month + '/' + parts.year + ' ' + parts.hour + ':' + parts.minute,\n };\n return {\n lead,\n values: [[lead.data, lead.nome, lead.email, lead.telefono, lead.messaggio, 'Nuovo']],\n alert: '๐Ÿ”” *Nuovo lead dal sito!*\\n\\n๐Ÿ‘ค ' + escapeMarkdown(lead.nome) + '\\n๐Ÿ“ง ' + escapeMarkdown(lead.email) + '\\n๐Ÿ“ž ' + escapeMarkdown(lead.telefono) + '\\n\\n๐Ÿ’ฌ ' + escapeMarkdown(lead.messaggio),\n email: lead.email,\n reply: 'Ciao ' + lead.nome + ',\\n\\ngrazie per averci contattato! Abbiamo ricevuto la tua richiesta e ti risponderemo entro poche ore lavorative.\\n\\nNel frattempo, se la cosa รจ urgente, puoi chiamarci direttamente.\\n\\nA presto,\\n' + signature,\n };\n};\n" } } }, "presentation": { "designer": { "version": 1, "flow": { "direction": "vertical" } } } }