Zoom API Webhooks
If you are leveraging Zoom Webhooks 2.x, there are no changes with the EventSubscriber implementation for 3.x.
Zoom API Module Webhook Configuration
- After enabling "Event Subscriptions" in the Zoom App Marketplace, you can grab your Secret Token.
- In Drupal, set the Event Secret Token in the Zoom API configuration. (see screenshot below)
- You can now proceed with validating your webhook endpoint. (see the validation details below)
Zoom released Webhook validation for all new webhooks created after Oct 23, 2022. All webhooks created prior to this date do not require validation unless you modify them. Webhook validation is required for all new and existing webhooks as of October 2023.
Webhook Validation
The following setup happens in your Zoom.us app setup in the "Feature" tab.
- Enter https://your-domain.com/zoomapi-webhooks for the "Event notification endpoint URL"
- If working locally, you'll need to use something like NGROK or Pagekite to expose your local environment. Otherwise, you can use any publicly available URL.
- The /zoomapi-webhooks endpoint will respond appropriately to the validation request as long as you've configured the Event Secret Token correctly.
Webhook Security
The Zoom API module webhook endpoint provided at /zoomapi-webhooks automatically handles verifying the x-zm-signature
header matches the contents of the payload. Zoom offers the ability to use custom headers, but the module currently only supports verifying the x-zm-signature
header. The module with return a status code of 403 if the the x-zm-signature
is not verified based on the Secret Token value.
You can checkout Zoom's Webhook documentation for more details.
Subscribing to Webhooks in a Custom Module
All events from Zoom API events dispatch a Drupal event that can be subscribed to in a custom module. This keeps things super flexible and allows our single webhook endpoint to handle many different things. You can checkout additional documentation on event subscribers.
- In your custom module, add the following to custom_module.services.yml
services: your_module.event_subscriber: class: Drupal\your_module\ZoomApiWebhookEventSubscriber tags: - {name: event_subscriber}
- In your custom module (custom_module/src) add ZoomApiWebhookEventSubscriber.php
<?php
namespace Drupal\custom_module;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\zoomapi\Event\ZoomApiEvents;
use Drupal\zoomapi\Event\ZoomApiWebhookEvent;
/**
* Subscribe to ZoomApi events.
*
* @package Drupal\custom_module\ZoomApiWebhookEventSubscriber
*/
class ZoomApiWebhookEventSubscriber implements EventSubscriberInterface {
use StringTranslationTrait;
/**
* {@inheritdoc}
*/
public static function getSubscribedEvents() {
$events[ZoomApiEvents::WEBHOOK_POST][] = ['subscribe'];
return $events;
}
/**
* {@inheritdoc}
*/
public function subscribe(ZoomApiWebhookEvent $event) {
\Drupal::logger('custom_module')->debug($event->getEvent());
}
}
Once your subscriber is setup, you'll have access to:
- event - Name of the webhook event from Zoom
- payload - Payload data from Zoom.
- request = The complete request from Zoom.
You can then do what you wish with the data utilizing all of Drupal's APIs.
Help improve this page
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion