# Embed the Appointment Picker

> Embed the MeetOne appointment picker widget in an iframe and handle its ready, resize, select, and deselect events with a working code sample.

Source: https://help.meetone.io/developers/integrations/embed-appointment-picker
Last updated: 2026-11-13

---

The MeetOne appointment picker is a lightweight iframe widget that lets visitors browse and select an available appointment slot directly on your website.

## Prerequisites

- A MeetOne tenant domain (for example `acme.meetone.io`) with the appointment picker enabled — contact MeetOne support ([support@meetone.io](mailto:support@meetone.io)) if you're not sure whether it's available for your account.
- The ability to add HTML and JavaScript to your website.

## Add the Iframe and Basic Styles

**1. Add the following styles to your HTML document.**

```html
<style>
/* Recommended height for screens up to 575px */
.meetone-appointment-picker iframe {
  display: block;
  height: 557px;
  max-width: 576px;
  margin: 0 auto;
}
/* Recommended height for screens from 576px */
@media (min-width: 576px) {
  .meetone-appointment-picker iframe {
    height: 361px;
  }
}
</style>
```

> **Note**
>
> The initial height above is only a sensible default. Use the `meetone.appointment-picker-ready` and `meetone.appointment-picker-resize` messages (below) to set the iframe's actual height once the widget reports it.

**2. Add the iframe to your HTML document.**

```html
<div class="meetone-appointment-picker">
  <iframe
    src="https://acme.meetone.io/static_pages/appointment-picker"
    width="100%">
  </iframe>
</div>
```

## Listen to Events

The picker runs on your MeetOne tenant domain, a different origin than your website, so it can't fire events on your page directly. Instead it sends each event to your page with [`postMessage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage). Listen for `message` events on `window` and read the event from `event.data`, where `type` is the event name. Always check `event.origin` against your tenant domain before using a message.

### meetone.appointment-picker-ready

Sent when the picker has loaded and is ready to use. Carries the picker's current `width` and `height`.

```javascript
window.addEventListener("message", (event) => {
  if (event.origin !== "https://acme.meetone.io") return;
  if (event.data?.type !== "meetone.appointment-picker-ready") return;

  console.log(event.data); // {type, width, height}
});
```

### meetone.appointment-picker-resize

Sent when the picker's dimensions change. Carries the picker's current `width` and `height`.

```javascript
window.addEventListener("message", (event) => {
  if (event.origin !== "https://acme.meetone.io") return;
  if (event.data?.type !== "meetone.appointment-picker-resize") return;

  console.log(event.data); // {type, width, height}
});
```

### meetone.appointment-picker-select

Sent when the user selects a time slot. Carries the selected `date` and `time`.

```javascript
window.addEventListener("message", (event) => {
  if (event.origin !== "https://acme.meetone.io") return;
  if (event.data?.type !== "meetone.appointment-picker-select") return;

  console.log(event.data); // {type, date, time}
});
```

### meetone.appointment-picker-deselect

Sent when the user deselects a time slot or picks another date, so that no slot is currently selected.

```javascript
window.addEventListener("message", (event) => {
  if (event.origin !== "https://acme.meetone.io") return;
  if (event.data?.type !== "meetone.appointment-picker-deselect") return;

  // No slot is selected
});
```

## Practical Example

Once the picker is loaded, assign its actual height to the iframe. The width is left responsive (no fixed value), and a disabled "Submit" button is enabled only once the visitor selects a time slot:

```html
<div class="meetone-appointment-picker">
  <iframe
    src="https://acme.meetone.io/static_pages/appointment-picker"
    width="100%">
  </iframe>
  <button disabled>Submit</button>
</div>

<script>
  const iframe = document.querySelector(".meetone-appointment-picker iframe");
  const button = document.querySelector(".meetone-appointment-picker button");

  window.addEventListener("message", (event) => {
    if (event.origin !== "https://acme.meetone.io") return;

    const data = event.data;
    if (!data) return;

    switch (data.type) {
      // Set the correct height when the picker is ready, and again whenever it resizes
      case "meetone.appointment-picker-ready":
      case "meetone.appointment-picker-resize":
        iframe.style.height = `${data.height}px`;
        break;

      // Enable the submit button and log the selection
      case "meetone.appointment-picker-select":
        button.removeAttribute("disabled");
        console.log(`${data.date}, ${data.time}`);
        break;

      // Disable the submit button again on deselection
      case "meetone.appointment-picker-deselect":
        button.setAttribute("disabled", true);
        console.log("No time selected");
        break;
    }
  });
</script>
```

## Security Considerations

If your website uses a Content Security Policy (CSP), allow iframes from your MeetOne tenant domain:

```html
<meta http-equiv="Content-Security-Policy"
      content="frame-src https://acme.meetone.io;">
```

Always serve both your page and the iframe over HTTPS.

## Related

- [Embed the Appointment Request Form](https://help.meetone.io/developers/integrations/embed-appointment-booking-form)
- [Embed the Patient Onboarding Wizard](https://help.meetone.io/developers/integrations/embed-onboarding-wizard)

Questions? Contact us at [support@meetone.io](mailto:support@meetone.io).
