> ## Documentation Index
> Fetch the complete documentation index at: https://developer.flabslis.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Templates

> The Flabs WhatsApp templates to copy into your provider.

export const WhatsAppTemplate = ({header, body, button}) => {
  const copy = event => {
    const button = event.currentTarget;
    navigator.clipboard.writeText(body).then(() => {
      button.textContent = "Copied ✓";
      setTimeout(() => {
        button.textContent = "Copy template";
      }, 1500);
    });
  };
  const renderBody = text => text.split(/(\*[^*\n]+\*)/g).map((part, i) => (/^\*[^*\n]+\*$/).test(part) ? <strong key={i} style={{
    color: "#111b21",
    fontWeight: 700
  }}>{part.slice(1, -1)}</strong> : <span key={i}>{part}</span>);
  const chatBg = {
    backgroundColor: "#efeae2",
    backgroundImage: "radial-gradient(rgba(0,0,0,0.05) 1.2px, transparent 1.2px), radial-gradient(rgba(0,0,0,0.035) 1px, transparent 1px)",
    backgroundSize: "22px 22px, 14px 14px",
    backgroundPosition: "0 0, 7px 9px"
  };
  const actionBtn = {
    background: "transparent",
    color: "inherit",
    border: "1px solid rgba(128,128,128,0.35)",
    borderRadius: 8,
    padding: "6px 14px",
    fontSize: 13,
    fontWeight: 500,
    cursor: "pointer"
  };
  return <div className="not-prose my-5" style={{
    maxWidth: 380
  }}>
      <div style={{
    borderRadius: 14,
    overflow: "hidden",
    boxShadow: "0 2px 8px rgba(0,0,0,0.18)"
  }}>
        <div style={{
    background: "#008069",
    color: "#fff",
    padding: "10px 14px",
    display: "flex",
    alignItems: "center",
    gap: 10
  }}>
          <div style={{
    width: 34,
    height: 34,
    borderRadius: "50%",
    background: "#dfe5e7",
    color: "#008069",
    display: "flex",
    alignItems: "center",
    justifyContent: "center",
    fontWeight: 700,
    fontSize: 14
  }}>L</div>
          <div style={{
    lineHeight: 1.25
  }}>
            <div style={{
    fontSize: 15,
    fontWeight: 600
  }}>Your Lab</div>
            <div style={{
    fontSize: 12,
    opacity: 0.85
  }}>Business account</div>
          </div>
        </div>
        <div style={{
    ...chatBg,
    padding: "16px 14px 18px"
  }}>
          <div style={{
    position: "relative",
    maxWidth: 320,
    marginLeft: 8
  }}>
            <svg width="8" height="13" viewBox="0 0 8 13" style={{
    position: "absolute",
    left: -8,
    top: 0
  }}>
              <path d="M8 0H1.5C0.2 0 -0.4 1.6 0.6 2.4L8 9V0Z" fill="#ffffff" />
            </svg>
            <div style={{
    background: "#ffffff",
    borderRadius: "0 8px 8px 8px",
    boxShadow: "0 1px 0.5px rgba(11,20,26,0.13)",
    overflow: "hidden"
  }}>
              {header && <div style={{
    padding: 4
  }}>
                  <div style={{
    background: "#f5f6f6",
    borderRadius: 6,
    padding: 10,
    display: "flex",
    alignItems: "center",
    gap: 10
  }}>
                    <svg width="26" height="32" viewBox="0 0 26 32">
                      <path d="M2 0h15l9 9v21a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2z" fill="#e5413a" />
                      <path d="M17 0l9 9h-7a2 2 0 0 1-2-2V0z" fill="#f28b85" />
                      <rect x="5" y="19" width="16" height="2" rx="1" fill="#ffffff" />
                      <rect x="5" y="23" width="11" height="2" rx="1" fill="#ffffff" />
                    </svg>
                    <div style={{
    lineHeight: 1.3
  }}>
                      <div style={{
    fontSize: 14,
    color: "#111b21"
  }}>{header}</div>
                      <div style={{
    fontSize: 12,
    color: "#667781"
  }}>1 page · PDF</div>
                    </div>
                  </div>
                </div>}
              <div style={{
    padding: header ? "4px 9px 2px" : "7px 9px 2px",
    fontSize: 14.2,
    lineHeight: "19px",
    color: "#111b21",
    whiteSpace: "pre-wrap",
    wordBreak: "break-word",
    fontFamily: "Segoe UI, Helvetica Neue, Helvetica, Arial, sans-serif"
  }}>
                {renderBody(body)}
              </div>
              <div style={{
    padding: "0 8px 5px",
    textAlign: "right",
    fontSize: 11,
    color: "#667781"
  }}>10:30 am</div>
              {button && <div style={{
    borderTop: "1px solid #e9edef",
    padding: "10px 0",
    display: "flex",
    alignItems: "center",
    justifyContent: "center",
    gap: 6,
    color: "#027eb5",
    fontSize: 14,
    fontWeight: 500
  }}>
                  <svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="#027eb5" strokeWidth="2.2" strokeLinecap="round" strokeLinejoin="round">
                    <path d="M14 3h7v7" />
                    <path d="M10 14L21 3" />
                    <path d="M21 14v5a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5" />
                  </svg>
                  {button}
                </div>}
            </div>
          </div>
        </div>
      </div>
      <details style={{
    marginTop: 10
  }}>
        <summary style={{
    ...actionBtn,
    display: "inline-block",
    listStyle: "none"
  }}>View text</summary>
        <pre style={{
    marginTop: 10,
    padding: 12,
    borderRadius: 8,
    border: "1px solid rgba(128,128,128,0.35)",
    fontSize: 13,
    lineHeight: "19px",
    whiteSpace: "pre-wrap",
    wordBreak: "break-word",
    fontFamily: "ui-monospace, SFMono-Regular, Menlo, monospace"
  }}>
          {body}
        </pre>
      </details>
      <button type="button" onClick={copy} style={{
    ...actionBtn,
    marginTop: 8
  }}>
        Copy template
      </button>
    </div>;
};

Create these templates in your WhatsApp provider, then fill them from the event: patient fields from `data.patientData`, everything else from `data.variables`. WhatsApp button URLs need a fixed domain, so the Download Report buttons use the domain of the report link (`https://<report-domain>/`) with the rest of the link as the variable. Use **Copy template** to copy the text exactly.

## Report to patient

<WhatsAppTemplate
  header="Report PDF"
  body={`Dear {{1}},

Important Update from {{2}} regarding your test results.

Your report is now available for collection. Kindly visit the lab to collect it at your earliest convenience.

For any further assistance, you can reach the lab at: {{3}} during working hours.`}
  button="Download Report"
/>

**Button:** Download Report → `https://<report-domain>/{{4}}`

| Variable | Fill with |
| - | - |
| Document | `reportLink` |
| `{{1}}` | `firstName` |
| `{{2}}` | `labName` |
| `{{3}}` | `labContact` |
| `{{4}}` | `reportLink` without its `https://<report-domain>/` part |

## Report due reminder

<WhatsAppTemplate
  body={`Dear *{{1}}*,

Your report is ready. Please pay your due payment.

Contact no. of *{{2}}* :- *{{3}}*.

Check Report Status: {{4}}

Thank you.`}
  button="Check Report Status"
/>

**Button:** Check Report Status → `https://records.flabslis.com/report-status/{{5}}`

| Variable | Fill with |
| - | - |
| `{{1}}` | `firstName` |
| `{{2}}` | `labName` |
| `{{3}}` | `labContact` |
| `{{4}}` | `reportStatusLink` |
| `{{5}}` | `data.billID` |

The event also carries `data.due` (with `data.total` and `data.paid`), so you can add the pending amount to your version of this template.

## Report to B2B centre

<WhatsAppTemplate
  header="Report PDF"
  body={`Dear B2B Client,
Patient Report Ready
Patient {{1}}, {{2}}, {{3}}.
Please download it!

{{4}}
Thanks`}
  button="Download Report"
/>

**Button:** Download Report → `https://<report-domain>/{{5}}`

| Variable | Fill with |
| - | - |
| Document | `reportWithLetterheadLink` or `reportWithoutLetterheadLink` |
| `{{1}}` | `firstName` |
| `{{2}}` | `age` + `ageType`, e.g. `32 year` |
| `{{3}}` | `gender` |
| `{{4}}` | `labName` |
| `{{5}}` | The same report link as the Document, without its `https://<report-domain>/` part |

## Report to doctor

<WhatsAppTemplate
  header="Report PDF"
  body={`Hello Dr. {{1}},

Report for {{2}} is ready.View report 👉 {{4}}

{{5}}
Please check and review at your convenience.`}
  button="Download Report"
/>

**Button:** Download Report → `https://<report-domain>/{{6}}`

| Variable | Fill with |
| - | - |
| Document | `reportLink` |
| `{{1}}` | `doctorName` |
| `{{2}}` | `firstName` + `lastName` |
| `{{4}}` | `reportLink` |
| `{{5}}` | `labName` |
| `{{6}}` | `reportLink` without its `https://<report-domain>/` part |

## Bill to patient

<WhatsAppTemplate
  header="Bill PDF"
  body={`Hi *{{1}}*,

You requested a copy of your bill from *{{2}}*.
The bill is attached to this message.
You can check your report status here: {{3}}

For any assistance, contact *{{4}}* at *{{5}}* during working hours.
Please check and review at your convenience.`}
  button="Check Report Status"
/>

**Button:** Check Report Status → `https://records.flabslis.com/report-status/{{6}}`

| Variable | Fill with |
| - | - |
| Document | `billLink` |
| `{{1}}` | `firstName` |
| `{{2}}` | `labName` |
| `{{3}}` | `reportStatusLink` |
| `{{4}}` | `labName` |
| `{{5}}` | `labContact` |
| `{{6}}` | `data.billID` |

## CRM messages

These are the default texts for the CRM and Bookings messages. To change them, contact Flabs support. A provider template always shows every line, so leave out optional lines (like Discount) if you don't want them blank.

### Patient Booking Confirmation

`booking.send`

<WhatsAppTemplate
  body={`Hi {{patient_name}}, your booking is scheduled on {{booking_date}}, {{booking_time}}.
Type: {{booking_type}}

Tests:
{{tests_list}}

Packages:
{{packages_list}}

Total MRP: ₹{{total_mrp}}
Discount: ₹{{discount}}
Total: ₹{{total_price}}

Thank you - {{lab_name}}`}
/>

| Variable | Fill with |
| - | - |
| `{{patient_name}}` | `patientData.firstName` + `patientData.lastName` |
| `{{booking_date}}`, `{{booking_time}}`, `{{booking_type}}` | `variables.bookingDate`, `.bookingTime`, `.bookingType` |
| `{{tests_list}}`, `{{packages_list}}` | `variables.testsList`, `.packagesList` |
| `{{total_mrp}}`, `{{discount}}`, `{{total_price}}` | `variables.totalMrp`, `.discount`, `.totalPrice` |
| `{{lab_name}}` | `variables.labName` |

### Phlebotomist Booking Details

`phlebotomist.send`

<WhatsAppTemplate
  body={`Hi {{phlebotomist_name}}, a new booking has been assigned to you.

Patient: {{patient_name}} ({{patient_phone}})
Date: {{booking_date}} at {{booking_time}}
Address: {{patient_address}}

Tests:
{{tests_list}}

Packages:
{{packages_list}}

Total MRP: ₹{{total_mrp}}
Discount: ₹{{discount}}
Total: ₹{{total_price}}

Please confirm receipt.
- {{lab_name}}`}
/>

| Variable | Fill with |
| - | - |
| `{{phlebotomist_name}}` | `variables.phlebotomistName` |
| `{{patient_name}}` | `patientData.firstName` + `patientData.lastName` |
| `{{patient_phone}}` | `patientData.contact` |
| `{{patient_address}}` | `patientData.address` |
| `{{booking_date}}`, `{{booking_time}}` | `variables.bookingDate`, `.bookingTime` |
| `{{tests_list}}`, `{{packages_list}}` | `variables.testsList`, `.packagesList` |
| `{{total_mrp}}`, `{{discount}}`, `{{total_price}}` | `variables.totalMrp`, `.discount`, `.totalPrice` |
| `{{lab_name}}` | `variables.labName` |

### Patient Quotation

`quotation.send`

<WhatsAppTemplate
  body={`Hi {{patient_name}}, here is your quotation from {{lab_name}}:

Tests:
{{tests_list}}

Packages:
{{packages_list}}

Total MRP: ₹{{total_mrp}}
Discount: ₹{{discount}}
Total: ₹{{total_price}}

Reply YES to confirm and book your tests.

Thank you - {{lab_name}}`}
/>

| Variable | Fill with |
| - | - |
| `{{patient_name}}` | `patientData.firstName` + `patientData.lastName` |
| `{{lab_name}}` | `variables.labName` |
| `{{tests_list}}`, `{{packages_list}}` | `variables.testsList`, `.packagesList` |
| `{{total_mrp}}`, `{{discount}}`, `{{total_price}}` | `variables.totalMrp`, `.discount`, `.totalPrice` |

Other default values (`uhid` → `patientData.uhid`, `company`, `corporateClient`, `quotationLines`, `testNames`, `patientMapLink`, `phlebotomistPhone`) are listed under [CRM messages](/whatsapp/payload#crm-messages). Custom fields (`{{cf_…}}`) are not sent.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.