Sistema automatizado de aprobación de citas, basado en GPT-4 Mini, JotForm y Telegram

Intermedio

Este es unautomatización que contiene 12 nodos.Utiliza principalmente nodos como If, Set, Gmail, Telegram, HttpRequest. Sistema automatizado de aprobación de citas, basado en GPT-4 Mini, JotForm y Telegram

Requisitos previos
  • Cuenta de Google y credenciales de API de Gmail
  • Bot Token de Telegram
  • Pueden requerirse credenciales de autenticación para la API de destino
  • Credenciales de API de Google Sheets
  • Clave de API de OpenAI

Categoría

-
Vista previa del flujo de trabajo
Visualización de las conexiones entre nodos, con soporte para zoom y panorámica
Exportar flujo de trabajo
Copie la siguiente configuración JSON en n8n para importar y usar este flujo de trabajo
{
  "meta": {
    "instanceId": "02059f0cb4b0ce23b903e8adf7a801dac35cd440dae5af845bde6649af1dcbcf",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "167a413a-b8d5-4111-be62-fd07f7b7413a",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        4688,
        1904
      ],
      "parameters": {
        "jsonSchemaExample": "{\n  \"email\": \"patient@example.com\",\n  \"subject\": \"Appointment Update - Rescheduling Required\",\n  \"html_body\": \"<html><body><h1>Appointment Update</h1><p>Dear Roshan Ramani,</p><p>Unfortunately, your requested appointment on <b>16 October 2025</b> could not be approved.</p><p>Please contact us to reschedule at your convenience or choose another available slot.</p><p>Thank you for understanding.<br><b>Doctor's Office</b></p></body></html>\"\n}\n"
      },
      "typeVersion": 1.3
    },
    {
      "id": "124507b2-9a28-47cc-921b-a7ee2c6ef8d7",
      "name": "Appointment Request Form Trigger",
      "type": "n8n-nodes-base.jotFormTrigger",
      "position": [
        3664,
        1680
      ],
      "webhookId": "WEBHOOK_ID_PLACEHOLDER_1",
      "parameters": {
        "form": "YOUR_JOTFORM_FORM_ID",
        "onlyAnswers": false
      },
      "typeVersion": 1
    },
    {
      "id": "16f11b9e-f72a-41e4-a87a-b27837e48a68",
      "name": "Parse: Extract Appointment Details",
      "type": "n8n-nodes-base.set",
      "position": [
        3920,
        1680
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "75edf02c-37a0-406e-96b0-5f86b83272b9",
              "name": "formID",
              "type": "string",
              "value": "={{ $json.formID }}"
            },
            {
              "id": "d9b6b0db-7440-41e5-90da-232c94dd4979",
              "name": "formTitle",
              "type": "string",
              "value": "={{ $json.formTitle }}"
            },
            {
              "id": "85a7a4a5-baf9-4fa3-8bf0-a6b8da4e6e50",
              "name": "submissionID",
              "type": "string",
              "value": "={{ $json.submissionID }}"
            },
            {
              "id": "972d74f3-14d2-4a8f-9cdc-58aeb5d8708c",
              "name": "rawRequest.Name",
              "type": "object",
              "value": "={{ $json.rawRequest.Name }}"
            },
            {
              "id": "8bac118c-3ab2-41e8-8faa-4265ea83cb5f",
              "name": "rawRequest['Phone Number']",
              "type": "object",
              "value": "={{ $json.rawRequest['Phone Number'] }}"
            },
            {
              "id": "05457476-3bde-419c-89fc-1d0380970bfc",
              "name": "rawRequest['E-mail']",
              "type": "string",
              "value": "={{ $json.rawRequest['E-mail'] }}"
            },
            {
              "id": "da5d98ef-4f4d-4f78-acf7-951ebe82fe38",
              "name": "rawRequest['First Time Visit?']",
              "type": "string",
              "value": "={{ $json.rawRequest['First Time Visit?'] }}"
            },
            {
              "id": "c3f4d7be-11e5-49bd-b02d-ad1cb2da3d12",
              "name": "rawRequest['Select an Appointment Date']",
              "type": "object",
              "value": "={{ $json.rawRequest['Select an Appointment Date'] }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "c1823ab1-a0c9-4fc8-adaf-317d119031d7",
      "name": "Notify for Approval or Decline",
      "type": "n8n-nodes-base.telegram",
      "position": [
        4208,
        1680
      ],
      "webhookId": "WEBHOOK_ID_PLACEHOLDER_2",
      "parameters": {
        "chatId": "YOUR_TELEGRAM_CHAT_ID",
        "message": "=Name : - {{ $json.rawRequest.Name.first }} {{ $json.rawRequest.Name.last }}\nnumber :- {{ $json.rawRequest['Phone Number'].full }}\nfirst time visit :- {{ $json.rawRequest['First Time Visit?'] }}\ndate time :- {{ $json.rawRequest['Select an Appointment Date'].date }}\nduration :- {{ $json.rawRequest['Select an Appointment Date'].duration }}",
        "options": {
          "appendAttribution": false
        },
        "operation": "sendAndWait",
        "approvalOptions": {
          "values": {
            "approvalType": "double"
          }
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "c64abc68-4dd0-4d02-9675-cef4fd950db8",
      "name": "Generate: Appointment Response Correo electrónico",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        4496,
        1680
      ],
      "parameters": {
        "text": "=doctor decision approved :- {{ $json.data.approved }}\n\ndata :- {{ $('Parse: Extract Appointment Details').item.json.rawRequest.toJsonString() }}\n\nPlease generate an appropriate email (confirmation or reschedule) based on the approval status.\n",
        "options": {
          "systemMessage": "=You are an Appointment Email Assistant for a Doctor's Office.\nYour job is to read appointment form data and the doctor's response, then generate the correct email to send to the patient.\n\nYour tasks:\n\nExtract patient details such as name, email, appointment date, and time from the form data.\n\nCheck if the doctor's approval status (approved) is true or false.\n\nIf approved = true, write a confirmation email confirming the appointment.\n\nIf approved = false, write a polite reschedule or decline email, offering the patient to choose another time or contact the clinic.\n\nAlways reply only in valid JSON format with exactly three fields:\n\nemail → patient's email address\n\nsubject → short and clear subject line\n\nhtml_body → full HTML message with <html>, <body>, <h1>, <p> tags etc.\n\nUse a warm, professional, and caring tone.\n\nAssume the email will be sent via the Gmail tool, so you only need to provide the content — not the sending logic.\n\nExample output when approved:\n\n{\n  \"email\": \"patient@example.com\",\n  \"subject\": \"Appointment Confirmed - 16 Oct 2025, 9:00 AM\",\n  \"html_body\": \"<html><body><h1>Your Appointment is Confirmed</h1><p>Dear Roshan Ramani,</p><p>Your appointment has been confirmed for <b>16 October 2025</b> at <b>9:00 AM</b>. Please arrive 10 minutes early.</p><p>If you have any questions, feel free to reply to this email.</p><p>Warm regards,<br><b>Doctor's Office</b></p></body></html>\"\n}\n\n\nExample output when not approved:\n\n{\n  \"email\": \"patient@example.com\",\n  \"subject\": \"Appointment Update - Rescheduling Required\",\n  \"html_body\": \"<html><body><h1>Appointment Update</h1><p>Dear Roshan Ramani,</p><p>Unfortunately, your requested appointment on <b>16 October 2025</b> could not be approved.</p><p>Please contact us to reschedule at your convenience or choose another available slot.</p><p>Thank you for understanding.<br><b>Doctor's Office</b></p></body></html>\"\n}\n"
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "38424ee8-2585-4ad1-bef6-d70069485596",
      "name": "Condition: Check Approval Status",
      "type": "n8n-nodes-base.if",
      "position": [
        4832,
        1680
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "cfff1aa3-d240-4527-a526-ebd7ab83c5a1",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $('Notify for Approval or Decline').item.json.data.approved }}",
              "rightValue": "true"
            }
          ]
        },
        "looseTypeValidation": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "f976d556-6d29-4d3a-9633-67bbb06d975e",
      "name": "Log: Record Appointment in sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        5040,
        1584
      ],
      "parameters": {
        "columns": {
          "value": {
            "name": "={{ $('Parse: Extract Appointment Details').item.json.rawRequest.Name.first }} {{ $('Parse: Extract Appointment Details').item.json.rawRequest.Name.last }}",
            "email": "={{ $('Parse: Extract Appointment Details').item.json.rawRequest['E-mail'] }}",
            "duration": "={{ $('Parse: Extract Appointment Details').item.json.rawRequest['Select an Appointment Date'].duration }}",
            "phone no": "={{ $('Parse: Extract Appointment Details').item.json.rawRequest['Phone Number'].full }}",
            "date and time": "={{ $('Parse: Extract Appointment Details').item.json.rawRequest['Select an Appointment Date'].date }}",
            "is_first time": "={{ $('Parse: Extract Appointment Details').item.json.rawRequest['First Time Visit?'] }}"
          },
          "schema": [
            {
              "id": "name",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "email",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "phone no",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "phone no",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "is_first time",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "is_first time",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "date and time",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "date and time",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "duration",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "duration",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "email"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_GOOGLE_SHEET_ID/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_GOOGLE_SHEET_ID",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_GOOGLE_SHEET_ID/edit?usp=drivesdk",
          "cachedResultName": "new form submissions"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "bbfba0b3-92fe-4da7-9456-aafe0ca911b2",
      "name": "Send: Confirmation Correo electrónico",
      "type": "n8n-nodes-base.gmail",
      "position": [
        5248,
        1584
      ],
      "webhookId": "WEBHOOK_ID_PLACEHOLDER_3",
      "parameters": {
        "sendTo": "={{ $('Generate: Appointment Response Email').item.json.output.email }}",
        "message": "={{ $('Generate: Appointment Response Email').item.json.output.html_body }}",
        "options": {},
        "subject": "={{ $('Generate: Appointment Response Email').item.json.output.subject }}"
      },
      "typeVersion": 2.1
    },
    {
      "id": "e74a6bbe-d2e2-4466-b5b7-3b943d684069",
      "name": "Send: Rejection or Reschedule Correo electrónico",
      "type": "n8n-nodes-base.gmail",
      "position": [
        5280,
        1856
      ],
      "webhookId": "WEBHOOK_ID_PLACEHOLDER_3",
      "parameters": {
        "sendTo": "={{ $('Generate: Appointment Response Email').item.json.output.email }}",
        "message": "={{ $('Generate: Appointment Response Email').item.json.output.html_body }}",
        "options": {},
        "subject": "={{ $('Generate: Appointment Response Email').item.json.output.subject }}"
      },
      "typeVersion": 2.1
    },
    {
      "id": "ff45d2d2-a900-492e-b881-ef6ba2b58a74",
      "name": "Delete Rejected Appointment",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        5056,
        1856
      ],
      "parameters": {
        "url": "=https://api.jotform.com/submission/{{ $('Parse: Extract Appointment Details').item.json.submissionID }}",
        "method": "DELETE",
        "options": {},
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "apiKey",
              "value": "YOUR_JOTFORM_API_KEY"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "134bcabc-106b-4916-9519-fe911ac63b91",
      "name": "Nota adhesiva2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3072,
        1392
      ],
      "parameters": {
        "width": 2448,
        "height": 880,
        "content": "#  AI Powered All Purpose Appointment System via JotForm\n\nThis workflow automates appointment requests by capturing form submissions, getting approval from a decision-maker, and sending appropriate confirmation or rejection emails.\n\n**What It Does:**\n- Captures new appointment requests from JotForm form\n- Sends appointment details for review and approval\n- Generates personalized confirmation or rejection emails using AI\n- Records approved appointments in Google Sheets\n- Handles both approvals and rejections automatically\n---\n\n👉 [Get the JotForm](https://www.jotform.com/?partner=roshanramanidev)\n\n**How It Works:**\n\n1. **Appointment Request Form Trigger** - New form submission arrives\n2. **Parse: Extract Appointment Details** - Pulls name, email, phone, date, time, visit type\n3. **Notify for Approval or Decline** - Sends details to approval channel for review\n4. **Generate: Appointment Response Email** - AI creates confirmation or reschedule email based on approval\n5. **Condition: Check Approval Status** - Routes to approved or rejected path\n   - **If Approved:**\n     - Log: Record Appointment in sheets - Stores in Google Sheets\n     - Send: Confirmation Email - Sends confirmation to requester\n   - **If Rejected:**\n     - Delete Rejected Appointment - Removes from form system\n     - Send: Rejection or Reschedule Email - Notifies requester\n\n**Key Benefits:**\n- Fully automated with no manual email writing\n- AI-powered personalized responses\n- Clean record keeping in Google Sheets\n- Instant approval/rejection notifications\n- Professional communication maintained\n\n---\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "4b623fe9-5505-47f1-b3ba-be5c0d1a49ec",
      "name": "Modelo de chat OpenAI6",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        4496,
        1888
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {}
      },
      "typeVersion": 1.2
    }
  ],
  "pinData": {},
  "connections": {
    "OpenAI Chat Model6": {
      "ai_languageModel": [
        [
          {
            "node": "Generate: Appointment Response Email",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "167a413a-b8d5-4111-be62-fd07f7b7413a": {
      "ai_outputParser": [
        [
          {
            "node": "Generate: Appointment Response Email",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "ff45d2d2-a900-492e-b881-ef6ba2b58a74": {
      "main": [
        [
          {
            "node": "Send: Rejection or Reschedule Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "c1823ab1-a0c9-4fc8-adaf-317d119031d7": {
      "main": [
        [
          {
            "node": "Generate: Appointment Response Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "124507b2-9a28-47cc-921b-a7ee2c6ef8d7": {
      "main": [
        [
          {
            "node": "16f11b9e-f72a-41e4-a87a-b27837e48a68",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "38424ee8-2585-4ad1-bef6-d70069485596": {
      "main": [
        [
          {
            "node": "f976d556-6d29-4d3a-9633-67bbb06d975e",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "ff45d2d2-a900-492e-b881-ef6ba2b58a74",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "f976d556-6d29-4d3a-9633-67bbb06d975e": {
      "main": [
        [
          {
            "node": "Send: Confirmation Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "16f11b9e-f72a-41e4-a87a-b27837e48a68": {
      "main": [
        [
          {
            "node": "c1823ab1-a0c9-4fc8-adaf-317d119031d7",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate: Appointment Response Email": {
      "main": [
        [
          {
            "node": "38424ee8-2585-4ad1-bef6-d70069485596",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Preguntas frecuentes

¿Cómo usar este flujo de trabajo?

Copie el código de configuración JSON de arriba, cree un nuevo flujo de trabajo en su instancia de n8n y seleccione "Importar desde JSON", pegue la configuración y luego modifique la configuración de credenciales según sea necesario.

¿En qué escenarios es adecuado este flujo de trabajo?

Intermedio

¿Es de pago?

Este flujo de trabajo es completamente gratuito, puede importarlo y usarlo directamente. Sin embargo, tenga en cuenta que los servicios de terceros utilizados en el flujo de trabajo (como la API de OpenAI) pueden requerir un pago por su cuenta.

Información del flujo de trabajo
Nivel de dificultad
Intermedio
Número de nodos12
Categoría-
Tipos de nodos11
Descripción de la dificultad

Adecuado para usuarios con experiencia intermedia, flujos de trabajo de complejidad media con 6-15 nodos

Autor
Roshan Ramani

Roshan Ramani

@rawsun007

I love building smart n8n automations that actually work reliably. My focus is on making everyday tasks like email, social media, and CRM workflows simpler using AI. I've shared templates in the n8n community, including a WhatsApp Expense Tracker that people really enjoy. What keeps me excited is constantly trying new things - testing fresh nodes, playing with AI tools like LangChain, and discovering creative ways to connect systems!

Enlaces externos
Ver en n8n.io

Compartir este flujo de trabajo

Categorías

Categorías: 34