English (United Kingdom)
Knowledge Base  >  Vik Appointments  >  Zoom  >  Plugin Hooks  >  Meeting Create

vikappointments_zoom_after_create_meeting

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
add_action('vikappointments_zoom_after_create_meeting', function($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);
    }
}, 10, 3);
Last Update: 2020-12-23
Helpful?