diff --git a/zoom_integration/zoom_integration/doctype/zoom_webinar/zoom_webinar.py b/zoom_integration/zoom_integration/doctype/zoom_webinar/zoom_webinar.py index 8c24a40..059be3a 100644 --- a/zoom_integration/zoom_integration/doctype/zoom_webinar/zoom_webinar.py +++ b/zoom_integration/zoom_integration/doctype/zoom_webinar/zoom_webinar.py @@ -127,17 +127,33 @@ def update_webinar_on_zoom_if_applicable(self): if zoom_related_field_not_updated: return - url = f"{ZOOM_API_BASE_PATH}/webinars/{self.zoom_webinar_id}" headers = get_authenticated_headers_for_zoom() - body = json.dumps( - { - "topic": self.title, - "agenda": self.agenda or self.title, - "duration": cint(self.duration / 60) if self.duration else 60, - "start_time": format_datetime(f"{self.date} {self.start_time}", "yyyy-MM-ddTHH:mm:ss"), - "timezone": self.timezone or "Asia/Calcutta", - } - ) + + is_webinar_plus = bool(self.zoom_event_id and self.zoom_ticket_id) + + if is_webinar_plus: + url = f"{ZOOM_API_BASE_PATH}/zoom_events/events/{self.zoom_event_id}" + body = json.dumps( + { + "topic": self.title, + "agenda": self.agenda or self.title, + "duration": cint(self.duration / 60) if self.duration else 60, + "start_time": format_datetime(f"{self.date} {self.start_time}", "yyyy-MM-ddTHH:mm:ss"), + "timezone": self.timezone or "Asia/Calcutta", + } + ) + else: + # Regular Webinar: Use Zoom Webinar API + url = f"{ZOOM_API_BASE_PATH}/webinars/{self.zoom_webinar_id}" + body = json.dumps( + { + "topic": self.title, + "agenda": self.agenda or self.title, + "duration": cint(self.duration / 60) if self.duration else 60, + "start_time": format_datetime(f"{self.date} {self.start_time}", "yyyy-MM-ddTHH:mm:ss"), + "timezone": self.timezone or "Asia/Calcutta", + } + ) response = requests.patch(url, headers=headers, data=body) if response.status_code == 204: