Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not able to create meeting with template id #128

Open
philharmonie opened this issue Feb 27, 2023 · 1 comment
Open

Not able to create meeting with template id #128

philharmonie opened this issue Feb 27, 2023 · 1 comment

Comments

@philharmonie
Copy link
Contributor

philharmonie commented Feb 27, 2023

I am trying to create a meeting from a template id:

class ZoomService
{
    const TYPE_SCHEDULED = 2;
    const TYPE_RECURRING = 8;
    const WEEKENDSEMINAR = "Weekend Seminar";
    const REGULARSEMINAR = "Regular Seminar";

    public static function createMeeting(Carbon $start, Carbon $end, string $type)
    {
        $user = Zoom::user()->find('me');

        // Get template id
        $templates = collect($user->handleResponse($user->sendRequest('get', ['users/' . $user->id . '/meeting_templates']))->templates);
        $template_id = $templates->filter(function ($template) use ($type) {
            return $template['name'] == $type;
        })->first()['id'] ?? null;

        if (is_null($template_id)) {
            Log::error("Template {$type} not found");
            throw new \Exception('Template not found');
        }

        $recurring = match ($type) {
            self::WEEKENDSEMINAR => true,
            self::REGULARSEMINAR => false,
            default => false
        };

        return Zoom::user()->find('me')->meetings()->create([
            'type' => $recurring ? self::TYPE_RECURRING : self::TYPE_SCHEDULED,
            'password' => (string) rand(100000, 999999),
            'timezone' => config('app.timezone'),
            'duration' => $start->diffInMinutes($end),
            'start_time' => $start->format('Y-m-d\TH:i:s'),
            'template_id' => $template_id,
            'recurrence' => [
                'end_date_time' => $end->format('Y-m-d\TH:i:s'),
                'end_times' => $recurring ? $start->diffInDays($end) + 1 : 1,
                'type' => 1
            ]
        ]);
    }
}

The template id exists and is the same like the ID in the URL when I open the template from the Zoom web UI.
None of the template settings are used for the created meeting and the meeting topic is the default topic.
The weirdest observation is, that when I dd() the created meeting, I see in the attributes, that the template_id is set correctly:

array:21 [▼
    "type" => 2
    "password" => "309551"
    "timezone" => "Europe/Berlin"
    "duration" => 1860
    "start_time" => "2023-03-01T09:00:00Z"
    "template_id" => "AxH9m6YgSfqL8SrpXVWweg" <-- this is the correct id
    "user_id" => "Wh2bmT_bQfyxK3qKoeW9jw"
    "uuid" => "IglPzGivRuCaZymPXaQ6jg=="
    "id" => 75228235554
    "host_id" => "Wh2bmT_bQfyxK3qKoeW8jk"
    "host_email" => "[email protected]"
    "topic" => "Zoom Meeting"
    "status" => "waiting"
    "created_at" => "2023-02-27T09:26:29Z"
    "start_url" => "https://us06web.zoom.us/s/...▶"
    "join_url" => "https://us06web.zoom.us/j/..."
    "h323_password" => "309551"
    "pstn_password" => "309551"
    "encrypted_password" => "bStId1NDODhQVFhOSllQWENUOHptZz08"
    "settings" => array:36 [▶]
    "pre_schedule" => false
  ]
@mjzavar
Copy link

mjzavar commented Jul 18, 2023

same problem here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants