PHP Example for Webhook Events

Can I have a simple php example to make a webhook event works for webinar.participant_joined?

Which App Type (OAuth / Chatbot / JWT / Webhook)?

Which Endpoint/s?
I am setting up on this link:

Thank you.

I used this code to get the data:
$json = file_get_contents(“php://input”)

The data is then added to my file using this code:
file_put_contents($myFile, $data)

but when I try to get a specific data like id, user_id, and user_name, I got no result.

I tried using $json->payload->object->id;

Any help would be appreciated.
Thank you.

I got it!
Here is my code:

        if ($_SERVER['REQUEST_METHOD'] == 'POST'){

        	$data = file_get_contents("php://input");
        	$decode = json_decode($data);

        	// expecting valid json
            if (json_last_error() !== JSON_ERROR_NONE) {
                die(header('HTTP/1.0 415 Unsupported Media Type'));

        	$file = 'events.json';

             * Do something with object, structure will be like:
             * $object->accountId
             * $object->details->items[0]['contactName']
            // dump to file so you can see

            file_put_contents($file, print_r($decode->event, true) . PHP_EOL, FILE_APPEND);



Hey @jkhliffz, thanks for posting and using Zoom!

I am glad you figured out the issue!

Let us know if you ever have additional questions! :slight_smile:


1 Like