Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
"attendance_synced",
"column_break_lihm",
"zoom_webinar_id",
"zoom_webinar_plus_section",
"zoom_event_id",
"column_break_oxmt",
"zoom_ticket_id",
"section_break_tuka",
"description"
],
Expand Down Expand Up @@ -132,6 +136,25 @@
"fieldname": "timezone",
"fieldtype": "Autocomplete",
"label": "Timezone"
},
{
"fieldname": "zoom_webinar_plus_section",
"fieldtype": "Section Break",
"label": "Zoom Webinar Plus"
},
{
"fieldname": "zoom_event_id",
"fieldtype": "Data",
"label": "Zoom Event ID"
},
{
"fieldname": "column_break_oxmt",
"fieldtype": "Column Break"
},
{
"fieldname": "zoom_ticket_id",
"fieldtype": "Data",
"label": "Zoom Ticket ID"
}
],
"grid_page_length": 50,
Expand All @@ -146,7 +169,7 @@
"link_fieldname": "webinar"
}
],
"modified": "2025-12-09 13:30:38.107775",
"modified": "2026-03-11 10:25:34.016507",
"modified_by": "Administrator",
"module": "Zoom Integration",
"name": "Zoom Webinar",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ class ZoomWebinar(Document):
template: DF.Link | None
timezone: DF.Autocomplete | None
title: DF.Data
zoom_event_id: DF.Data | None
zoom_link: DF.Data | None
zoom_ticket_id: DF.Data | None
zoom_webinar_id: DF.Data | None
# end: auto-generated types

Expand Down Expand Up @@ -176,20 +178,38 @@ def add_registrant(
if not additional_params:
additional_params = {}

url = f"{ZOOM_API_BASE_PATH}/webinars/{self.zoom_webinar_id}/registrants"
headers = get_authenticated_headers_for_zoom()
body = json.dumps(
{"email": email, "first_name": first_name, "last_name": last_name or "N/A", **additional_params}
)

response = requests.post(url, headers=headers, data=body)
if response.status_code == 201:
data = response.json()
create_request_log(
data, is_remote_request=1, service_name="Zoom", request_headers=headers, status="Completed"
is_webinar_plus = 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}/tickets"
body = json.dumps(
{
"tickets": [
{
"email": email,
"first_name": first_name,
"last_name": last_name or "N/A",
"ticket_type_id": self.zoom_ticket_id,
**additional_params,
}
]
}
)
return data
else:
url = f"{ZOOM_API_BASE_PATH}/webinars/{self.zoom_webinar_id}/registrants"
body = json.dumps(
{
"email": email,
"first_name": first_name,
"last_name": last_name or "N/A",
**additional_params,
}
)

response = requests.post(url, headers=headers, data=body)

if response.status_code not in (200, 201):
create_request_log(
response.text,
is_remote_request=1,
Expand All @@ -199,6 +219,21 @@ def add_registrant(
)
frappe.throw(frappe._(f"Failed to add registrant: {response.text}"))

data = response.json()
create_request_log(
data, is_remote_request=1, service_name="Zoom", request_headers=headers, status="Completed"
)

if is_webinar_plus:
ticket = data.get("tickets", [{}])[0]
return {
"registrant_id": ticket.get("ticket_id"),
"join_url": ticket.get("event_join_link"),
"email": ticket.get("email"),
}

return data

@frappe.whitelist()
def sync_attendance(self):
try:
Expand All @@ -225,7 +260,9 @@ def sync_attendance(self):

for attendance in batch:
registration = frappe.db.get_value(
"Zoom Webinar Registration", {"email": attendance.get("user_email", "N/A")}, "name"
"Zoom Webinar Registration",
{"email": attendance.get("user_email", "N/A")},
"name",
)

try:
Expand Down
Loading