Knowledge base Drupal Embedding
Microsoft Bookings Integration
Embed booking widgets that push appointments into Office 365 with calendar synchronization and automated confirmations.
Published 15 February 2024
Overview
Microsoft Bookings integration for Drupal provides a comprehensive scheduling solution that embeds directly into your website. This integration enables automated appointment management, calendar synchronization, and professional communication with clients through the Microsoft 365 ecosystem.
Features
- Embeddable booking widget in Drupal pages
- Automated appointment creation in Office 365
- Calendar synchronization across platforms
- Automated email confirmations and reminders
- Staff availability management
- Service and pricing configuration
- Customer self-service booking
- Appointment cancellation and rescheduling
Technical Details
Technologies: Microsoft Bookings API, Microsoft Graph API, Drupal Block API, Drupal Form API, JavaScript SDK, OAuth 2.0
Requirements:
- Drupal 9.x or 10.x
- Microsoft 365 Business with Bookings
- Azure AD app with Bookings.ReadWrite.All permission
- SSL certificate for production
- Calendar.ReadWrite permission for staff
API Endpoints:
List businesses: GET /solutions/bookingBusinesses
Create appointment: POST /solutions/bookingBusinesses/{id}/appointments
Get appointment: GET /solutions/bookingBusinesses/{id}/appointments/{appointment-id}
Cancel appointment: POST /solutions/bookingBusinesses/{id}/appointments/{appointment-id}/cancel
Implementation
- Configure Azure AD app with Bookings permissions
- Create Microsoft Bookings business
- Configure services, staff, and availability
- Create Drupal block plugin for booking widget
- Implement Graph API client for appointments
- Build booking form with validation
- Set up webhook for appointment notifications
- Implement calendar synchronization
- Add customer communication templates
- Configure confirmation and reminder emails
<?php
// Example: Drupal block for Bookings widget
namespace Drupal\bookings_integration\Plugin\Block;
use Drupal\Core\Block\BlockBase;
use Drupal\Core\Form\FormStateInterface;
/**
* @Block(
* id = "microsoft_bookings_widget",
* admin_label = @Translation("Microsoft Bookings Widget"),
* category = @Translation("Microsoft 365")
* )
*/
class MicrosoftBookingsBlock extends BlockBase {
public function build() {
$business_id = $this->configuration['business_id'];
$service_id = $this->configuration['service_id'];
return [
'#theme' => 'bookings_widget',
'#business_id' => $business_id,
'#service_id' => $service_id,
'#attached' => [
'library' => ['bookings_integration/widget'],
'drupalSettings' => [
'bookingsIntegration' => [
'businessId' => $business_id,
'serviceId' => $service_id,
'apiEndpoint' => '/api/bookings/create',
],
],
],
];
}
public function blockForm($form, FormStateInterface $form_state) {
$form['business_id'] = [
'#type' => 'textfield',
'#title' => $this->t('Bookings Business ID'),
'#default_value' => $this->configuration['business_id'] ?? '',
'#required' => TRUE,
];
$form['service_id'] = [
'#type' => 'textfield',
'#title' => $this->t('Service ID'),
'#default_value' => $this->configuration['service_id'] ?? '',
'#description' => $this->t('Leave empty to show all services'),
];
return $form;
}
public function blockSubmit($form, FormStateInterface $form_state) {
$this->configuration['business_id'] = $form_state->getValue('business_id');
$this->configuration['service_id'] = $form_state->getValue('service_id');
}
}
Use Cases
- Healthcare appointment scheduling
- Professional services consultations
- Educational institution office hours
- Client onboarding sessions
- Service-based business bookings
Benefits
- Professional scheduling without third-party tools
- Automated calendar management
- Reduced no-shows with reminders
- 24/7 self-service booking availability
- Integration with existing Office 365 calendars
- Branded booking experience
- Reduced administrative scheduling overhead
Read next
-
Drupal · Authentication and access
Secure Azure AD Authentication for Drupal
Implement single-sign-on with Office 365 accounts using OAuth 2.0 flows, JWT tokens, and Drupal's user system with Azure AD integration.
-
Drupal · Data and documents
SharePoint List & Webhook Event Engine
Subscribe to SharePoint list changes with webhooks, trigger Drupal workflows or Power Automate flows, and enable two-way list editing.
-
Drupal · Data and documents
Excel Online Data Integration
Read and write spreadsheet data via Microsoft Graph API with inline data editors embedded in Drupal pages and scheduled exports.