Embedding Your Booking Page
Every booking instance has its own booking page, for example https://your-business.bookbot.io. You can also run the same booking flow inside your own website. This article is for the web developer adding it.
Getting the Code
- In BotScheduling, open the booking instance and click Embed in Website
- Choose HTML, React or Events
- Click Copy
The code already includes your instance's slug.
If the booking page's address changes, code that uses the old slug keeps working for 30 days. Copy the code again, or replace the instance value, before then.
HTML
Load the script once, anywhere on the page. Then place the element where the booking flow should appear.
<script src="https://bookbot.io/widget/botscheduling-widget.umd.cjs" async></script>
<botscheduling-widget instance="your-business"></botscheduling-widget>
React
The widget registers itself as a custom element. Load it with a script tag rather than importing it, so your bundler doesn't try to resolve it.
import { useEffect } from 'react';
export default function BookingWidget() {
useEffect(() => {
if (customElements.get('botscheduling-widget')) return;
const script = document.createElement('script');
script.src = 'https://bookbot.io/widget/botscheduling-widget.umd.cjs';
script.async = true;
document.head.appendChild(script);
}, []);
return <botscheduling-widget instance="your-business" />;
}
Attributes
What the booking flow offers (locations, services and resources) is set on the instance in BotScheduling. These attributes only control how it is presented on your site.
instance- Required. The booking instance slug.compact-"true"shows the flow without the summary sidebar, for a narrow column.hide-steps- Comma-separated step ids to skip, for example"welcome,location".theme- JSON overrides forprimaryColor,secondaryColorandfontFamily. Invalid JSON is ignored and logged to the browser console.
<botscheduling-widget
instance="your-business"
compact="true"
theme='{"primaryColor": "#1a73e8", "fontFamily": "Inter, sans-serif"}'>
</botscheduling-widget>
Events
The widget fires two events. Both bubble, so you can listen on the element or on a parent.
const widget = document.querySelector('botscheduling-widget');
widget.addEventListener('booking-complete', (event) => {
console.log(event.detail.startsOn);
});
widget.addEventListener('booking-error', (event) => {
console.error(event.detail.message);
});
- booking-complete - Fired once the appointment is created.
event.detailincludescustomerName,companyName,service,location,date,time,resourcesandstartsOn(ISO 8601). - booking-error - Fired when the flow can't load or the booking fails to save.
event.detail.messagedescribes the problem.
Styling
The widget renders in a shadow DOM, so your page's styles don't affect it. Use the theme attribute to match your colors and font.
Updates and Going Live
The widget reads its configuration each time it loads. Changes published in BotScheduling appear on your site without another deploy.
If the instance isn't live yet, the widget still loads but won't take bookings. See Sharing Your Booking Page to publish it.