I am using the following script to create a Zoom meeting for the people in our firm. I, as the developer, assume the host role and able to see the rooms being created and assign people in the meeting to these rooms.
I want three things:
- I don’t want to be the one starting the meeting, the meeting should start as soon as somebody uses the
join_url
- I want all breakout rooms to already be visible to all participants without the host’s input for “Open All Rooms”
- I want all participants to be able to switch between rooms as they please.
My code is as below:
# Function to get the OAuth token using base64 encoding for Authorization header
def get_oauth_token(client_id, client_secret, account_id):
token_url = f"https://zoom.us/oauth/token?grant_type=account_credentials&account_id={account_id}"
# Base64 encoding the client_id and client_secret
base64_auth = base64.b64encode(f"{client_id}:{client_secret}".encode('utf-8')).decode('utf-8')
headers = {
"Authorization": f"Basic {base64_auth}"
}
token_response = requests.post(token_url, headers=headers)
if token_response.status_code == 200:
token_json = token_response.json()
return token_json["access_token"]
else:
print(f"Failed to get OAuth token: {token_response.content}")
return None
# Function to create a Zoom meeting
def create_zoom_meeting(user_id, oauth_token):
todays_password = "".join([str(np.random.randint(9)) for x in range(6)])
print(todays_password)
print("start_time", start_time)
headers = {
"Authorization": f"Bearer {oauth_token}",
"Content-Type": "application/json"
}
payload = {
"topic": "Tom's Crazy Science Experiments!",
"type": 1, # 1 for instant meeting
#"duration": 1400,
"password": todays_password,
"settings": {
"breakout_room": {
"enable": True,
"rooms": [{"name": x, "participants": []} for x in ["X1", "X2", "X3", "X4",
"Extra Room 1", "Extra Room 2", "Extra Room 3",
"Extra Room 4", "Extra Room 5"]]
},
"enforce_login": False,
"waiting_room": False,
"show_share_button": True,
"allow_multiple_devices": True,
"start_time": start_time,
"host_email": "some@email.com",
"join_before_host": True,
}
}
meeting_url = f"{BASE_URL}/users/{user_id}/meetings"
meeting_response = requests.post(meeting_url, headers=headers, data=json.dumps(payload))
if meeting_response.status_code == 201:
print("Meeting created successfully")
return meeting_response.json()
else:
print(f"Failed to create meeting: {meeting_response.content}")
return None