onAfterCreateZoomMeeting

Trigger event to perform additional actions after creating a new Zoom meeting. This event can be used, in example, to send notifications to the customers.

Parameters

$meeting VAPZoomMeeting The instance that incapsulates the meeting details.
$order array An associative array containing the appointment information.
$is_new boolean In case of services that can host more than one appointment per time, the system assigns the same meeting to several reservations. For this reason, when attempting to create a new meeting, this one might have been already created for an appointment already registered for the same date and time. In this case, the plugin will create only a relation between the appointment and the existing meeting. Only here the argument will assume a true value.

Return Value

None.

1.1

The example below explains how to register a callback that sends a SMS notification to the customer every time a meeting is created/registered.

// hook used to send a SMS notification to the customer containing the link to join the meeting
public function onAfterCreateZoomMeeting($meeting, $order, $is_new)
{
    // make sure the phone number is set
    if (empty($order['purchaser_phone']))
    {
        return;
    }

    // prepare notification text
    $template = __("Your meeting has been saved successfully, you can use the link below to start the video-call:\n%s", 'vikappointments-zoom');
    // include JOIN URL within the template
    $template = sprintf($template, $meeting->get('join_url'));

    // get SMS driver and path
    $sms_api_name = VikAppointments::getSmsApi();
    $sms_api_path = VAPADMIN . DIRECTORY_SEPARATOR . 'smsapi' . DIRECTORY_SEPARATOR . $sms_api_name;

    if ($sms_api_name && is_file($sms_api_path))
    {
        // include driver file
        require_once $sms_api_path;

        // get SMS API parameters
        $sms_api_params = VikAppointments::getSmsApiFields(true);

        // instantiate driver
        $api = new VikSmsApi($order, $sms_api_params);
        
        // send SMS to customer
        $api->sendMessage($order['purchaser_prefix'] . $order['purchaser_phone'], $template);
    }
}
Last Update: 2020-12-23 10:32
Helpful?
This site uses cookies. By continuing to browse you accept their use. Further information