Ask patients for feedback the day after their visit

The day after a visit, each patient gets a WhatsApp message with a short feedback form.

Easy Saves ~3 hours/month Clinics & WellnessBy Flowngn team

Works with n8n · Make · Zapier

How it works

Trigger: Schedule — every day at 11:00
  1. Read the Appointments sheet.
  2. Find yesterday's completed visits that haven't been asked yet.
  3. Send a WhatsApp template with your feedback form link.
  4. Mark each row as sent.

Diagram

Every day 11:00Schedule TriggerGRead appointmentsGoogle Sheets{ }Yesterday's visitsCodeWAsk for feedbackWhatsApp Business CloudGMark as sentGoogle Sheets
Trigger App Code

Code

JavaScript used in the Code step — already included in the template below.

Yesterday's visits · Code node
// Appointments sheet columns: date (YYYY-MM-DD) | time | patient | phone | doctor | status | feedback_sent
// Keeps yesterday's completed visits that haven't been asked for feedback.
const yesterday = new Date(Date.now() - 24 * 60 * 60 * 1000).toISOString().slice(0, 10);

return $input.all()
  .map((item) => item.json)
  .filter((a) => String(a.date).slice(0, 10) === yesterday)
  .filter((a) => String(a.status).toLowerCase() === "done" && !a.feedback_sent && a.phone)
  .map((a) => ({
    json: {
      row_number: a.row_number,
      phone: String(a.phone).replace(/[^0-9]/g, ""),
      patient: a.patient,
      doctor: a.doctor,
    },
  }));

Build it

Pick your tool — same automation, step by step.

Copy and paste straight into an n8n canvas (Ctrl+V), or download and use Import from File. Then connect your own credentials and replace every YOUR_… placeholder.

Workflow JSON
Show code (203 lines)
{
  "name": "Ask patients for feedback the day after their visit (Flowngn)",
  "nodes": [
    {
      "parameters": {
        "content": "## Ask patients for feedback the day after their visit\nThe day after a visit, each patient gets a WhatsApp message with a short feedback form.\n\n**Setup**\n1. Open each node and connect your own credentials.\n2. Replace every YOUR_… placeholder.\n3. Test once, then activate.\n\nFree template from Flowngn",
        "height": 260,
        "width": 340
      },
      "id": "43ef734d-6128-488d-aff4-ce1dfd7659e4",
      "name": "Setup notes",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -420,
        -60
      ]
    },
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 11
            }
          ]
        }
      },
      "id": "43ef734d-6128-488d-aff4-ce1dfd7659e4",
      "name": "Every day 11:00",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        0,
        0
      ]
    },
    {
      "parameters": {
        "operation": "read",
        "documentId": {
          "__rl": true,
          "value": "YOUR_SPREADSHEET_ID",
          "mode": "id"
        },
        "sheetName": {
          "__rl": true,
          "value": "Appointments",
          "mode": "name"
        },
        "options": {}
      },
      "id": "43ef734d-6128-488d-aff4-ce1dfd7659e4",
      "name": "Read appointments",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.5,
      "position": [
        300,
        0
      ]
    },
    {
      "parameters": {
        "jsCode": "// Appointments sheet columns: date (YYYY-MM-DD) | time | patient | phone | doctor | status | feedback_sent\n// Keeps yesterday's completed visits that haven't been asked for feedback.\nconst yesterday = new Date(Date.now() - 24 * 60 * 60 * 1000).toISOString().slice(0, 10);\n\nreturn $input.all()\n  .map((item) => item.json)\n  .filter((a) => String(a.date).slice(0, 10) === yesterday)\n  .filter((a) => String(a.status).toLowerCase() === \"done\" && !a.feedback_sent && a.phone)\n  .map((a) => ({\n    json: {\n      row_number: a.row_number,\n      phone: String(a.phone).replace(/[^0-9]/g, \"\"),\n      patient: a.patient,\n      doctor: a.doctor,\n    },\n  }));"
      },
      "id": "43ef734d-6128-488d-aff4-ce1dfd7659e4",
      "name": "Yesterday's visits",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        600,
        0
      ]
    },
    {
      "parameters": {
        "operation": "sendTemplate",
        "phoneNumberId": "YOUR_PHONE_NUMBER_ID",
        "recipientPhoneNumber": "={{ $json.phone }}",
        "template": "YOUR_FEEDBACK_TEMPLATE|ar",
        "components": {
          "component": [
            {
              "type": "body",
              "bodyParameters": {
                "parameter": [
                  {
                    "type": "text",
                    "text": "={{ $json.patient }}"
                  },
                  {
                    "type": "text",
                    "text": "={{ $json.doctor }}"
                  },
                  {
                    "type": "text",
                    "text": "YOUR_FEEDBACK_FORM_LINK"
                  }
                ]
              }
            }
          ]
        }
      },
      "id": "43ef734d-6128-488d-aff4-ce1dfd7659e4",
      "name": "Ask for feedback",
      "type": "n8n-nodes-base.whatsApp",
      "typeVersion": 1,
      "position": [
        900,
        0
      ]
    },
    {
      "parameters": {
        "operation": "update",
        "documentId": {
          "__rl": true,
          "value": "YOUR_SPREADSHEET_ID",
          "mode": "id"
        },
        "sheetName": {
          "__rl": true,
          "value": "Appointments",
          "mode": "name"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "row_number": "={{ $('Yesterday\\'s visits').item.json.row_number }}",
            "feedback_sent": "={{ $now.toISODate() }}"
          },
          "matchingColumns": [
            "row_number"
          ]
        },
        "options": {}
      },
      "id": "43ef734d-6128-488d-aff4-ce1dfd7659e4",
      "name": "Mark as sent",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.5,
      "position": [
        1200,
        0
      ]
    }
  ],
  "connections": {
    "Every day 11:00": {
      "main": [
        [
          {
            "node": "Read appointments",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read appointments": {
      "main": [
        [
          {
            "node": "Yesterday's visits",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Yesterday's visits": {
      "main": [
        [
          {
            "node": "Ask for feedback",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Ask for feedback": {
      "main": [
        [
          {
            "node": "Mark as sent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "meta": {
    "templateCredsSetupCompleted": false
  },
  "tags": []
}

Open in the playground to edit →

Tips

  • Pair it with the negative feedback alert flow so a manager calls unhappy patients the same day.

Related flows