PHP code example of binary-cats / laravel-zoom-webhooks

1. Go to this page and download the library: Download binary-cats/laravel-zoom-webhooks library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

binary-cats / laravel-zoom-webhooks example snippets


return [

    /*
     * Zoom will sign each webhook using a verification token. You can find the secret used
     * in the  page of your Marketplace app: .
     */
    'signing_secret' => env('ZOOM_WEBHOOK_SECRET'),

    /*
     * You can define the job that should be run when a certain webhook hits your application
     * here. The key is the name of the Zoom event type with the `.` replaced by a `_`.
     *
     * You can find a list of Zoom webhook types here:
     * https://marketplace.zoom.us/docs/api-reference/webhook-reference#events.
     */
    'jobs' => [
        // 'meeting_started' => \BinaryCats\ZoomWebhooks\Jobs\HandleMeetingStarted::class,
    ],

    /*
     * The classname of the model to be used. The class should equal or extend
     * Spatie\WebhookClient\Models\WebhookCall
     */
    'model' => \Spatie\WebhookClient\Models\WebhookCall::class,

    /*
     * The classname of the model to be used. The class should equal or extend
     * BinaryCats\ZoomWebhooks\ProcessZoomWebhookJob
     */
    'process_webhook_job' => \BinaryCats\ZoomWebhooks\ProcessZoomWebhookJob::class,
];

# routes\web.php
Route::zoomWebhooks('webhooks/zoom');

protected $except = [
    'webhooks/zoom',
];

protected $except = [
    'webhooks/*',
];



namespace App\Jobs\ZoomWebhooks;

use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Spatie\WebhookClient\Models\WebhookCall;

class HandleMeetingStarted implements ShouldQueue
{
    use InteractsWithQueue, Queueable, SerializesModels;

    /** @var \Spatie\WebhookClient\Models\WebhookCall */
    public $webhookCall;

    public function __construct(WebhookCall $webhookCall)
    {
        $this->webhookCall = $webhookCall;
    }

    public function handle()
    {
        // do your work here

        // you can access the payload of the webhook call with `$this->webhookCall->payload`
    }
}

// config/zoom-webhooks.php

'jobs' => [
    'meeting_started' => \App\Jobs\ZoomWebhooks\HandleMeetingStarted::class,
],

/**
 * The event listener mappings for the application.
 *
 * @var array
 */
protected $listen = [
    'zoom-webhooks::meeting.started' => [
        App\Listeners\Zoom\MeetingStarted::class,
    ],
];



namespace App\Listeners\Zoom;

use Illuminate\Contracts\Queue\ShouldQueue;
use Spatie\WebhookClient\Models\WebhookCall;

class MeetingStarted implements ShouldQueue
{
    public function handle(WebhookCall $webhookCall)
    {
        // do your work here

        // you can access the payload of the webhook call with `$webhookCall->payload`
    }
}

use Spatie\WebhookClient\Models\WebhookCall;
use BinaryCats\ZoomWebhooks\ProcessZoomWebhookJob;

dispatch(new ProcessZoomWebhookJob(WebhookCall::find($id)));

use BinaryCats\ZoomWebhooks\ProcessZoomWebhookJob;

class MyCustomZoomWebhookJob extends ProcessZoomWebhookJob
{
    public function handle()
    {
        // do some custom stuff beforehand

        parent::handle();

        // do some custom stuff afterwards
    }
}

Route::zoomWebhooks('webhooks/zoom/{configKey}');

Route::post('webhooks/zoom/{configKey}', 'BinaryCats\ZoomWebhooks\ZoomWebhooksController');

// secret for when Zoom posts to webhooks/zoom/account
'signing_secret_account' => 'whsec_abcdef',
// secret for when Zoom posts to webhooks/zoom/my-special-secret
'signing_secret_my-special-secret' => 'whsec_123456',
bash
php artisan vendor:publish --provider="BinaryCats\ZoomWebhooks\ZoomWebhooksServiceProvider" --tag="config"
bash
php artisan vendor:publish --provider="Spatie\WebhookClient\WebhookClientServiceProvider" --tag="migrations"
bash
php artisan migrate