Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

video-calls: Add Constructor Groups video call integration.

Fatih Sözüer1f4db3cbbaa1
diff --git a/api_docs/changelog.md b/api_docs/changelog.md
index 6b77773e2fc..fceb37248bb 100644
--- a/api_docs/changelog.md
+++ b/api_docs/changelog.md
@@ -20,6 +20,14 @@ format used by the Zulip server that they are interacting with.
## Changes in Zulip 12.0
+**Feature level 460**
+
+* [`POST /register`](/api/register-queue), [`GET /events`](/api/get-events),
+ `PATCH /realm`: Constructor Groups integration added as an option
+ for the realm setting `video_chat_provider`.
+* [`POST /calls/constructorgroups/create`](/api/create-constructor-groups-video-call):
+ Added a new endpoint to create a Constructor Groups video call URL.
+
**Feature level 459**
* [`DELETE /users/{user_id}`](/api/deactivate-user): Added new
diff --git a/api_docs/include/rest-endpoints.md b/api_docs/include/rest-endpoints.md
index a7d84a1d1d4..daec24fbe4d 100644
--- a/api_docs/include/rest-endpoints.md
+++ b/api_docs/include/rest-endpoints.md
@@ -169,4 +169,5 @@
* [Add an FCM registration token](/api/add-fcm-token)
* [Remove an FCM registration token](/api/remove-fcm-token)
* [Create BigBlueButton video call](/api/create-big-blue-button-video-call)
+* [Create Constructor Groups video call](/api/create-constructor-groups-video-call)
* [Outgoing webhook payloads](/api/outgoing-webhook-payload)
diff --git a/docs/production/securing-your-zulip-server.md b/docs/production/securing-your-zulip-server.md
index dc88501d8a0..4303e25bd65 100644
--- a/docs/production/securing-your-zulip-server.md
+++ b/docs/production/securing-your-zulip-server.md
@@ -94,7 +94,8 @@ system. Reading the following guides will give you a good starting point:
- Inline image previews in messages (enabled by default, but can be disabled)
- Inline webpage previews and embeds (must be configured to be enabled)
- Twitter message previews (must be configured to be enabled)
- - BigBlueButton and Zoom API requests (must be configured to be enabled)
+ - BigBlueButton, Constructor Groups, and Zoom API requests
+ (must be configured to be enabled)
- Mobile push notifications (must be configured to be enabled)
- Notably, these first 3 features give end users (limited) control to cause
diff --git a/docs/production/video-calls.md b/docs/production/video-calls.md
index f1f0b1d5562..2ae1874b534 100644
--- a/docs/production/video-calls.md
+++ b/docs/production/video-calls.md
@@ -9,6 +9,7 @@ supported by Zulip are:
100% open source video conferencing solution.
- [Zoom](https://zulip.com/integrations/zoom)
- [BigBlueButton](https://zulip.com/integrations/big-blue-button)
+- [Constructor Groups](https://zulip.com/integrations/category/video-calling)
By default, Zulip uses the [cloud version of Jitsi Meet](https://meet.jit.si/)
as its call provider. This page documents the configurations required to support
@@ -178,3 +179,10 @@ This enables BigBlueButton support in your Zulip server. Finally, [configure
BigBlueButton as the video call
provider](https://zulip.com/help/configure-call-provider)
in the Zulip organizations where you want to use it.
+
+## Constructor Groups
+
+To use the [Constructor Groups](https://constructor.tech/products/learning/groups)
+video call integration on a self-hosted Zulip installation, you'll need to
+have a Constructor Groups account. See documentation to configure the Constructor
+Groups video call integration [here](https://zulip.com/integrations/category/video-calling).
diff --git a/starlight_help/src/content/docs/configure-call-provider.mdx b/starlight_help/src/content/docs/configure-call-provider.mdx
index 479a5db0b22..9937f104e49 100644
--- a/starlight_help/src/content/docs/configure-call-provider.mdx
+++ b/starlight_help/src/content/docs/configure-call-provider.mdx
@@ -19,6 +19,7 @@ supported by Zulip are:
* [Jitsi Meet](/integrations/jitsi)
* [Zoom integration](/integrations/zoom)
* [BigBlueButton integration](/integrations/big-blue-button)
+* [Constructor Groups integration](/integrations/constructor-groups)
<ZulipTip>
You can disable the video and voice call buttons for your organization
@@ -58,3 +59,4 @@ instance of Jitsi Meet.
* [Jitsi Meet integration](/integrations/jitsi)
* [Zoom integration](/integrations/zoom)
* [BigBlueButton integration](/integrations/big-blue-button)
+* [Constructor Groups integration](/integrations/constructor-groups)
diff --git a/starlight_help/src/content/docs/start-a-call.mdx b/starlight_help/src/content/docs/start-a-call.mdx
index edfee4f6fc9..c1e6ffa91b8 100644
--- a/starlight_help/src/content/docs/start-a-call.mdx
+++ b/starlight_help/src/content/docs/start-a-call.mdx
@@ -95,4 +95,5 @@ you can unlink it.
* [Jitsi Meet integration](/integrations/jitsi)
* [Zoom integration](/integrations/zoom)
* [BigBlueButton integration](/integrations/big-blue-button)
+* [Constructor Groups integration](/integrations/constructor-groups)
* [Insert a link](/help/insert-a-link)
diff --git a/static/images/integrations/bot_avatars/constructor-groups.png b/static/images/integrations/bot_avatars/constructor-groups.png
new file mode 100644
index 00000000000..60f3667992d
Binary files /dev/null and b/static/images/integrations/bot_avatars/constructor-groups.png differ
diff --git a/static/images/integrations/logos/constructor-groups.svg b/static/images/integrations/logos/constructor-groups.svg
new file mode 100644
index 00000000000..754bc009d6a
--- /dev/null
+++ b/static/images/integrations/logos/constructor-groups.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" viewBox="0 0 1398 779"><path fill="#fff" d="M810 780H1.046V1.091H1398.83V780zm290.614-221.932c12.13-8.188 25.079-15.408 36.205-24.788 17.429-14.695 31.4-32.586 42.34-52.756 14.934-27.533 22.062-57.108 22.654-88.201.195-10.263-1.539-20.6-2.844-30.847-3.476-27.291-13.837-52.062-28.95-74.797-10.875-16.36-24.079-30.67-39.608-42.958-18.115-14.333-38.017-25.28-59.851-32.282-21.398-6.861-43.476-10.583-66.126-8.402-11.89 1.145-24.001 1.565-35.567 4.24-33.195 7.677-62.544 23.357-87.173 46.888-10.03 9.583-19.04 20.539-26.982 31.938-18.4 26.414-29.05 56.115-31.42 88.16-1.286 17.366-.995 34.925 2.527 52.352 4.833 23.91 13.457 46.058 26.712 66.495 10.096 15.565 21.758 29.805 36.441 41.173 10.803 8.363 21.785 16.79 33.693 23.368 24.395 13.476 51.011 20.37 78.791 22.27 15.696 1.073 31.401-.224 46.805-3.178 18.086-3.468 35.445-9.447 52.353-18.675m-713.55-281.13c1.427-.308 2.89-.99 4.276-.858 5.205.493 10.386 1.24 15.573 1.912 20.386 2.639 37.916 11.637 53.273 24.84 11.453 9.847 20.438 21.826 26.546 35.719 1.503 3.418 3.32 4.58 7 4.533 15.664-.198 31.332-.084 46.997-.084h33.443c-13.03-47.603-39.772-84.66-80.994-110.895-41.354-26.32-86.71-34.968-134.803-26.967-85.362 14.202-152.39 86.012-157.205 175.859-2.86 53.388 14.514 100.367 51.006 139.383 34.028 36.38 76.827 56.146 126.437 59.44 82.77 5.494 167.942-46.148 194.223-137.82h-4.472c-25.832 0-51.664.087-77.495-.101-3.562-.026-5.087 1.264-6.574 4.253-10.544 21.187-26.45 37.397-47.352 48.259-22.921 11.912-47.384 15.143-72.352 8.234-30.227-8.365-52.591-27.268-67.526-54.724-7.291-13.404-11.469-27.827-13.247-43.128-1.545-13.29-1.267-26.432 1.576-39.307 5.942-26.898 19.257-49.485 41.23-66.665 17.531-13.708 37.186-21.36 60.44-21.884M644.46 458.036 619.421 492c28.591 0 56.237.046 83.882-.117 1.643-.01 3.822-1.295 4.832-2.665 10.478-14.212 20.741-28.581 31.115-42.87 12.573-17.318 25.055-34.706 37.932-51.796 2.16-2.866 1.695-4.539.06-6.787-22.207-30.546-44.396-61.105-66.685-91.591-2.221-3.039-4.45-5.484-9.395-5.383-23.153.47-46.32.209-69.483.209h-11.915l75.133 100.214c-4.04 5.333-7.979 10.5-11.883 15.692-12.683 16.868-25.353 33.745-38.553 51.13"/><path fill="#e04130" d="M1100.304 558.287c-16.598 9.01-33.957 14.988-52.043 18.456-15.404 2.954-31.109 4.25-46.805 3.177-27.78-1.9-54.396-8.793-78.79-22.269-11.909-6.578-22.89-15.005-33.694-23.368-14.683-11.368-26.345-25.608-36.44-41.173-13.256-20.437-21.88-42.585-26.713-66.495-3.522-17.427-3.813-34.986-2.528-52.352 2.371-32.045 13.02-61.746 31.421-88.16 7.941-11.399 16.952-22.355 26.982-31.938 24.629-23.53 53.978-39.21 87.173-46.888 11.566-2.675 23.676-3.095 35.567-4.24 22.65-2.181 44.728 1.54 66.126 8.402 21.834 7.002 41.736 17.949 59.851 32.282 15.53 12.287 28.733 26.599 39.608 42.958 15.113 22.735 25.474 47.506 28.95 74.797 1.305 10.246 3.039 20.584 2.844 30.847-.592 31.093-7.72 60.668-22.653 88.2-10.94 20.17-24.912 38.062-42.341 52.757-11.126 9.38-24.074 16.6-36.515 25.007M1119 393.494c-.662-9.016-.531-18.175-2.128-27.022-5.626-31.179-22.204-55.715-48.387-73.065-22.75-15.075-48.363-20.275-75.287-15.212-25.065 4.713-45.786 17.32-62.178 37.165-18.278 22.127-26.172 47.835-26.84 75.97-.185 7.754 1.59 15.595 2.851 23.333 3.534 21.674 13.44 40.394 27.9 56.59 10.683 11.966 23.716 20.921 38.698 27.055 19.384 7.935 39.38 10.107 59.643 5.4 24.624-5.722 45.43-18.462 60.928-38.601 15.92-20.688 25.273-44.01 24.8-71.613"/><path fill="#00a6df" d="M386.606 276.964c-22.796.497-42.45 8.149-59.982 21.857-21.973 17.18-35.288 39.767-41.23 66.665-2.843 12.875-3.121 26.017-1.576 39.307 1.778 15.301 5.956 29.724 13.247 43.128 14.935 27.456 37.299 46.36 67.526 54.724 24.968 6.909 49.43 3.678 72.352-8.234 20.902-10.862 36.808-27.072 47.352-48.259 1.487-2.989 3.012-4.28 6.574-4.253 25.83.188 51.663.101 77.495.101h4.472c-26.281 91.672-111.452 143.314-194.223 137.82-49.61-3.294-92.409-23.06-126.437-59.44-36.492-39.016-53.867-85.995-51.006-139.383 4.815-89.847 71.843-161.657 157.205-175.859 48.092-8.001 93.449.647 134.803 26.967C534.4 258.34 561.14 295.397 574.172 343h-33.443c-15.665 0-31.333-.114-46.996.084-3.682.046-5.498-1.115-7-4.533-6.11-13.893-15.094-25.872-26.547-35.718-15.357-13.204-32.887-22.202-53.273-24.841-5.187-.672-10.368-1.419-15.573-1.912-1.386-.131-2.849.55-4.734.884"/><path fill="#00204d" d="M644.724 457.78c12.937-17.129 25.607-34.006 38.29-50.874 3.904-5.192 7.843-10.36 11.883-15.692L619.764 291h11.915c23.162 0 46.33.262 69.483-.21 4.944-.1 7.174 2.345 9.395 5.384 22.29 30.486 44.478 61.045 66.685 91.59 1.635 2.249 2.1 3.922-.06 6.788-12.877 17.09-25.36 34.478-37.932 51.796-10.374 14.289-20.637 28.658-31.115 42.87-1.01 1.37-3.189 2.656-4.832 2.665-27.645.163-55.291.117-83.882.117 8.634-11.71 16.837-22.838 25.303-34.22"/><path fill="#fff" d="M1119 393.992c.473 27.104-8.88 50.427-24.8 71.115-15.498 20.139-36.304 32.88-60.928 38.6-20.263 4.708-40.259 2.536-59.643-5.4-14.982-6.133-28.015-15.088-38.698-27.054-14.46-16.196-24.366-34.916-27.9-56.59-1.26-7.738-3.036-15.58-2.851-23.333.668-28.135 8.562-53.843 26.84-75.97 16.392-19.844 37.113-32.452 62.178-37.165 26.924-5.063 52.538.137 75.287 15.212 26.183 17.35 42.76 41.886 48.387 73.065 1.597 8.847 1.466 18.006 2.128 27.52"/></svg>
\ No newline at end of file
diff --git a/templates/zerver/integrations/big-blue-button.md b/templates/zerver/integrations/big-blue-button.md
index 750711f6410..a02cd4184ad 100644
--- a/templates/zerver/integrations/big-blue-button.md
+++ b/templates/zerver/integrations/big-blue-button.md
@@ -46,4 +46,5 @@ as your call provider instead.
- [How to start a call](/help/start-a-call)
- [Jitsi Meet integration](/integrations/jitsi)
- [Zoom integration](/integrations/zoom)
+- [Constructor Groups integration](/integrations/constructor-groups)
* [BigBlueButton server configuration](https://docs.bigbluebutton.org/administration/customize/#other-configuration-changes)
diff --git a/templates/zerver/integrations/constructor-groups.md b/templates/zerver/integrations/constructor-groups.md
new file mode 100644
index 00000000000..d403dc7a694
--- /dev/null
+++ b/templates/zerver/integrations/constructor-groups.md
@@ -0,0 +1,57 @@
+# Use Constructor Groups as your call provider in Zulip
+
+You can configure [Constructor Groups][constructor-groups] as the call
+provider for your organization. Users will be able to start a Constructor
+Groups call and invite others using the **add video call**
+(<i class="zulip-icon zulip-icon-video-call"></i>) button [in the compose
+box](/help/start-a-call).
+
+!!! warn ""
+
+ **Note:** This is currently only possible on self-hosted Zulip
+ installations, and requires a Constructor Groups account.
+
+## Configure Constructor Groups as your call provider
+
+By default, Zulip integrates with
+[Jitsi Meet](https://jitsi.org/jitsi-meet/), a fully-encrypted, 100% open
+source video conferencing solution. You can configure Zulip to use
+[Constructor Groups][constructor-groups] as your call provider instead.
+
+{start_tabs}
+
+1. Obtain your Constructor Groups [API credentials][constructor-groups-api-docs]
+ by going to your Constructor Groups dashboard. Select **Settings**, and
+ open the **Development** tab. Click the **Create new API Key** button,
+ fill the required fields, and click **Create**. Copy your **Access Key**
+ and **Secret Key** from the window that opens.
+
+1. In `/etc/zulip/zulip-secrets.conf`, set `constructor_groups_access_key`
+ and `constructor_groups_secret_key` to the access key and secret key
+ created in the previous step.
+
+1. In `/etc/zulip/settings.py`, set `CONSTRUCTOR_GROUPS_URL` to your
+ Constructor Groups API URL, e.g., `https://example.constructor.app/api/groups/xapi`.
+
+1. Restart the Zulip server with
+ `/home/zulip/deployments/current/scripts/restart-server`.
+
+{settings_tab|organization-settings}
+
+1. Under **Compose settings**, select Constructor Groups from the
+ **Call provider** dropdown.
+
+1. Click **Save changes**.
+
+{end_tabs}
+
+### Related documentation
+
+- [Constructor Groups API documentation][constructor-groups-api-docs]
+- [How to start a call](/help/start-a-call)
+- [Jitsi Meet integration](/integrations/jitsi)
+- [Zoom integration](/integrations/zoom)
+- [BigBlueButton integration](/integrations/big-blue-button)
+
+[constructor-groups-api-docs]: https://developer.perculus.com/v2-en
+[constructor-groups]: https://constructor.tech/products/learning/groups
diff --git a/templates/zerver/integrations/jitsi.md b/templates/zerver/integrations/jitsi.md
index f6753933d3a..2b9c2d31bd8 100644
--- a/templates/zerver/integrations/jitsi.md
+++ b/templates/zerver/integrations/jitsi.md
@@ -32,3 +32,4 @@ instance of Jitsi Meet.
- [How to start a call](/help/start-a-call)
- [Zoom integration](/integrations/zoom)
- [BigBlueButton integration](/integrations/big-blue-button)
+- [Constructor Groups integration](/integrations/constructor-groups)
diff --git a/templates/zerver/integrations/zoom.md b/templates/zerver/integrations/zoom.md
index b055a6b83af..8f6b17cb750 100644
--- a/templates/zerver/integrations/zoom.md
+++ b/templates/zerver/integrations/zoom.md
@@ -39,3 +39,4 @@ in order to use this integration.
- [How to start a call](/help/start-a-call)
- [Jitsi Meet integration](/integrations/jitsi)
- [BigBlueButton integration](/integrations/big-blue-button)
+- [Constructor Groups integration](/integrations/constructor-groups)
diff --git a/tools/lib/capitalization.py b/tools/lib/capitalization.py
index 259e117a140..8c2a916b6f4 100644
--- a/tools/lib/capitalization.py
+++ b/tools/lib/capitalization.py
@@ -58,6 +58,7 @@ IGNORED_PHRASES = [
r"Zulip Cloud Plus",
r"Zulip Desktop",
r"BigBlueButton",
+ r"Constructor Groups",
# Code things
r"\.zuliprc",
# BeautifulSoup will remove <z-user> which is horribly confusing,
diff --git a/version.py b/version.py
index 35206f13cf0..993ec214250 100644
--- a/version.py
+++ b/version.py
@@ -35,7 +35,7 @@ DESKTOP_WARNING_VERSION = "5.9.3"
# new level means in api_docs/changelog.md, as well as "**Changes**"
# entries in the endpoint's documentation in `zulip.yaml`.
-API_FEATURE_LEVEL = 459
+API_FEATURE_LEVEL = 460
# Bump the minor PROVISION_VERSION to indicate that folks should provision
# only when going from an old version of the code to a newer version. Bump
diff --git a/web/src/compose_call_ui.ts b/web/src/compose_call_ui.ts
index bef6bbfe44a..11dc139e24d 100644
--- a/web/src/compose_call_ui.ts
+++ b/web/src/compose_call_ui.ts
@@ -140,6 +140,32 @@ export function generate_and_insert_audio_or_video_call_link(
}
},
});
+ } else if (realm.realm_video_chat_provider === available_providers.constructor_groups?.id) {
+ compose_call.abort_video_callbacks(edit_message_id);
+ const key = edit_message_id ?? "";
+
+ const xhr = channel.post({
+ url: "/json/calls/constructorgroups/create",
+ data: {},
+ success(response) {
+ const data = call_response_schema.parse(response);
+ compose_call.video_call_xhrs.delete(key);
+ insert_video_call_url(data.url, $target_textarea);
+ },
+ error(_xhr, status) {
+ compose_call.video_call_xhrs.delete(key);
+ if (status !== "abort") {
+ ui_report.generic_embed_error(
+ $t_html({defaultMessage: "Failed to create video call."}),
+ 2000,
+ );
+ }
+ },
+ });
+
+ if (xhr !== undefined) {
+ compose_call.video_call_xhrs.set(key, xhr);
+ }
} else {
const video_call_id = util.random_int(100000000000000, 999999999999999);
const video_call_url = compose_call.get_jitsi_server_url(video_call_id.toString());
diff --git a/web/src/state_data.ts b/web/src/state_data.ts
index 768591c198d..5689db9a22d 100644
--- a/web/src/state_data.ts
+++ b/web/src/state_data.ts
@@ -455,6 +455,7 @@ export const realm_schema = z.object({
zoom: z.optional(z.object({name: z.string(), id: z.number()})),
zoom_server_to_server: z.optional(z.object({name: z.string(), id: z.number()})),
big_blue_button: z.optional(z.object({name: z.string(), id: z.number()})),
+ constructor_groups: z.optional(z.object({name: z.string(), id: z.number()})),
}),
realm_avatar_changes_disabled: z.boolean(),
realm_bot_domain: z.string(),
diff --git a/web/tests/compose_video.test.cjs b/web/tests/compose_video.test.cjs
index f366294268f..db06bc3c6a5 100644
--- a/web/tests/compose_video.test.cjs
+++ b/web/tests/compose_video.test.cjs
@@ -64,6 +64,10 @@ const realm_available_video_chat_providers = {
id: 4,
name: "BigBlueButton",
},
+ constructor_groups: {
+ id: 6,
+ name: "Constructor Groups",
+ },
};
function test(label, f) {
@@ -269,6 +273,49 @@ test("videos", ({override}) => {
assert.ok(called);
assert.match(syntax_to_insert, audio_link_regex);
})();
+
+ (function test_constructor_groups_video_link_compose_clicked() {
+ let syntax_to_insert;
+ let called = false;
+
+ const $textarea = $.create("constructor-groups-target-stub");
+ $textarea.set_parents_result(".message_edit_form", []);
+
+ const ev = {
+ preventDefault() {},
+ stopPropagation() {},
+ };
+
+ override(compose_ui, "insert_syntax_and_focus", (syntax) => {
+ syntax_to_insert = syntax;
+ called = true;
+ });
+
+ override(
+ realm,
+ "realm_video_chat_provider",
+ realm_available_video_chat_providers.constructor_groups.id,
+ );
+
+ channel.post = (payload) => {
+ assert.equal(payload.url, "/json/calls/constructorgroups/create");
+ assert.deepEqual(payload.data, {}); // Empty data object
+ payload.success({
+ result: "success",
+ msg: "",
+ url: "https://example.constructor.app/groups/room/room-123",
+ });
+ return {abort() {}};
+ };
+
+ $("textarea#compose-textarea").val("");
+ const video_handler = $("body").get_on_handler("click", ".video_link");
+ video_handler.call($textarea, ev);
+ const video_link_regex =
+ /\[translated: Join video call\.]\(https:\/\/example\.constructor\.app\/groups\/room\/room-123\)/;
+ assert.ok(called);
+ assert.match(syntax_to_insert, video_link_regex);
+ })();
});
test("test_video_chat_button_toggle disabled", ({override}) => {
@@ -301,3 +348,14 @@ test("test_video_chat_button_toggle enabled", ({override}) => {
compose_setup.initialize();
assert.equal($(".compose-control-buttons-container .video_link").visible(), true);
});
+
+test("test_constructor_groups_video_chat_button_toggle enabled", ({override}) => {
+ override(
+ realm,
+ "realm_video_chat_provider",
+ realm_available_video_chat_providers.constructor_groups.id,
+ );
+ override(window, "to_$", () => $("window-stub"));
+ compose_setup.initialize();
+ assert.equal($(".compose-control-buttons-container .video_link").visible(), true);
+});
diff --git a/web/tests/settings_org.test.cjs b/web/tests/settings_org.test.cjs
index 0f657af1fba..e2e538a7d38 100644
--- a/web/tests/settings_org.test.cjs
+++ b/web/tests/settings_org.test.cjs
@@ -439,6 +439,10 @@ test("set_up", ({override, override_rewire}) => {
id: 4,
name: "BigBlueButton",
},
+ constructor_groups: {
+ id: 6,
+ name: "Constructor Groups",
+ },
});
override(realm, "realm_message_retention_days", null);
diff --git a/zerver/lib/integrations.py b/zerver/lib/integrations.py
index d4fe58c5c8d..a8ef383cb28 100644
--- a/zerver/lib/integrations.py
+++ b/zerver/lib/integrations.py
@@ -966,6 +966,9 @@ VIDEO_CALL_INTEGRATIONS: list[Integration] = [
Integration(
"big-blue-button", ["video-calling", "communication"], display_name="BigBlueButton"
),
+ Integration(
+ "constructor-groups", ["video-calling", "communication"], display_name="Constructor Groups"
+ ),
Integration("jitsi", ["video-calling", "communication"], display_name="Jitsi Meet"),
Integration("zoom", ["video-calling", "communication"]),
]
@@ -1152,7 +1155,7 @@ INTEGRATIONS_WITHOUT_SCREENSHOTS = (
# Outgoing integrations
| {"email", "onyx"}
# Video call integrations
- | {"big-blue-button", "jitsi", "zoom"}
+ | {"big-blue-button", "constructor-groups", "jitsi", "zoom"}
| {
# these integrations do not send messages
"giphy",
diff --git a/zerver/models/realms.py b/zerver/models/realms.py
index 9086e133cd6..42debf9056b 100644
--- a/zerver/models/realms.py
+++ b/zerver/models/realms.py
@@ -656,6 +656,10 @@ class Realm(models.Model):
"name": "Zoom",
"id": 5,
},
+ "constructor_groups": {
+ "name": "Constructor Groups",
+ "id": 6,
+ },
}
video_chat_provider = models.PositiveSmallIntegerField(
@@ -1075,6 +1079,12 @@ class Realm(models.Model):
or settings.VIDEO_ZOOM_CLIENT_SECRET is None
):
continue
+ if provider == "constructor_groups" and (
+ settings.CONSTRUCTOR_GROUPS_ACCESS_KEY is None
+ or settings.CONSTRUCTOR_GROUPS_SECRET_KEY is None
+ or settings.CONSTRUCTOR_GROUPS_URL is None
+ ):
+ continue
enabled_video_chat_providers[provider] = self.VIDEO_CHAT_PROVIDERS[provider]
return enabled_video_chat_providers
diff --git a/zerver/openapi/test_curl_examples.py b/zerver/openapi/test_curl_examples.py
index 9fcca8c4b37..ea82d2c4d43 100644
--- a/zerver/openapi/test_curl_examples.py
+++ b/zerver/openapi/test_curl_examples.py
@@ -33,6 +33,8 @@ UNTESTED_GENERATED_CURL_EXAMPLES = {
# Having a message for a specific user available to test this endpoint
# is tricky for testing.
"delete-reminder",
+ # Would need Constructor Groups credentials configured to test this endpoint.
+ "create-constructor-groups-video-call",
}
diff --git a/zerver/openapi/zulip.yaml b/zerver/openapi/zulip.yaml
index 659a27ca455..88b061743e3 100644
--- a/zerver/openapi/zulip.yaml
+++ b/zerver/openapi/zulip.yaml
@@ -5490,11 +5490,15 @@ paths:
- 3 = Zoom (User OAuth integration)
- 4 = BigBlueButton
- 5 = Zoom (Server to Server OAuth integration)
+ - 6 = Constructor Groups
Note that only one of the [Zoom integrations][zoom-video-calls] can
be configured on a Zulip server.
- **Changes**: In Zulip 10.0 (feature level 353), added the Zoom Server
+ **Changes**: In Zulip 12.0 (feature level 460), added the
+ Constructor Groups option.
+
+ In Zulip 10.0 (feature level 353), added the Zoom Server
to Server OAuth option.
In Zulip 3.0 (feature level 1), added the None option
@@ -19196,11 +19200,15 @@ paths:
- 3 = Zoom (User OAuth integration)
- 4 = BigBlueButton
- 5 = Zoom (Server to Server OAuth integration)
+ - 6 = Constructor Groups
Note that only one of the [Zoom integrations][zoom-video-calls] can
be configured on a Zulip server.
- **Changes**: In Zulip 10.0 (feature level 353), added the Zoom Server
+ **Changes**: In Zulip 12.0 (feature level 460), added the
+ Constructor Groups option.
+
+ In Zulip 10.0 (feature level 353), added the Zoom Server
to Server OAuth option.
In Zulip 3.0 (feature level 1), added the None option
@@ -25285,6 +25293,42 @@ paths:
"url": "/calls/bigbluebutton/join?meeting_id=%22zulip-something%22&password=%22something%22&checksum=%22somechecksum%22",
}
+ /calls/constructorgroups/create:
+ post:
+ tags: ["channels"]
+ operationId: create-constructor-groups-video-call
+ summary: Create Constructor Groups video call
+ description: |
+ Create a video call URL for a Constructor Groups video call.
+ Requires [Constructor Groups](/integrations/constructor-groups)
+ to be configured on the Zulip server.
+
+ **Changes**: New in Zulip 12.0 (feature level 460).
+ responses:
+ "200":
+ description: Success.
+ content:
+ application/json:
+ schema:
+ allOf:
+ - $ref: "#/components/schemas/JsonSuccessBase"
+ - additionalProperties: false
+ properties:
+ result: {}
+ msg: {}
+ ignored_parameters_unsupported: {}
+ url:
+ description: |
+ The URL for the Constructor Groups video call.
+ type: string
+ example: "https://example.constructor.app/groups/room/room-123"
+ example:
+ {
+ "msg": "",
+ "result": "success",
+ "url": "https://example.constructor.app/groups/room/room-123",
+ }
+
components:
#######################
# Security definitions
diff --git a/zerver/tests/test_create_video_call.py b/zerver/tests/test_create_video_call.py
index 12189065510..79c33e6e158 100644
--- a/zerver/tests/test_create_video_call.py
+++ b/zerver/tests/test_create_video_call.py
@@ -533,3 +533,144 @@ class BigBlueButtonVideoCallTest(ZulipTestCase):
{"bigbluebutton": self.signed_bbb_a_object},
)
self.assert_json_error(response, "BigBlueButton is not configured.")
+
+
+class ConstructorGroupsVideoCallTest(ZulipTestCase):
+ @override
+ def setUp(self) -> None:
+ super().setUp()
+ self.user_profile = self.example_user("hamlet")
+ self.login_user(self.user_profile)
+
+ self.base_api_url = "https://example.constructor.app/api/groups/xapi"
+
+ self.test_room_guid = "a13b8686-d383-4763-b3b7-d2d4dd7f34ec"
+ self.test_room_name = "King Hamlet's Zulip room"
+ self.test_room_url = f"https://example.constructor.app/groups/room/{self.test_room_name}"
+
+ self.mock_valid_room = {
+ "room_guid": self.test_room_guid,
+ "name": self.test_room_name,
+ "url": self.test_room_url,
+ }
+
+ self.mock_room_missing_url = {
+ "room_guid": self.test_room_guid,
+ "name": self.test_room_name,
+ }
+
+ def test_missing_constructor_groups_settings(self) -> None:
+ for setting_name in [
+ "CONSTRUCTOR_GROUPS_URL",
+ "CONSTRUCTOR_GROUPS_ACCESS_KEY",
+ "CONSTRUCTOR_GROUPS_SECRET_KEY",
+ ]:
+ with self.settings(**{setting_name: None}):
+ response = self.client_post("/json/calls/constructorgroups/create")
+ self.assert_json_error(response, "Failed to create Constructor Groups call")
+
+ @responses.activate
+ def test_get_existing_room(self) -> None:
+ responses.add(
+ responses.POST,
+ f"{self.base_api_url}/room/default",
+ json=self.mock_valid_room,
+ status=200,
+ )
+
+ response = self.client_post("/json/calls/constructorgroups/create")
+
+ response_dict = self.assert_json_success(response)
+ self.assertEqual(response_dict["url"], self.test_room_url)
+ self.assert_length(responses.calls, 1)
+
+ @responses.activate
+ def test_create_new_room(self) -> None:
+ responses.add(
+ responses.POST,
+ f"{self.base_api_url}/room/default",
+ json=self.mock_valid_room,
+ status=201,
+ )
+
+ response = self.client_post("/json/calls/constructorgroups/create")
+
+ response_dict = self.assert_json_success(response)
+ self.assertEqual(response_dict["url"], self.test_room_url)
+ self.assert_length(responses.calls, 1)
+
+ @responses.activate
+ def test_missing_url_in_response(self) -> None:
+ responses.add(
+ responses.POST,
+ f"{self.base_api_url}/room/default",
+ json=self.mock_room_missing_url,
+ status=200,
+ )
+
+ with self.assertLogs(level="ERROR") as logs:
+ response = self.client_post("/json/calls/constructorgroups/create")
+
+ self.assert_json_error(response, "Failed to create Constructor Groups call")
+ self.assertIn("Constructor Groups API returned room without URL", logs.output[0])
+
+ @responses.activate
+ def test_http_request_error_handling(self) -> None:
+ responses.add(
+ responses.POST,
+ f"{self.base_api_url}/room/default",
+ status=500,
+ )
+
+ with self.assertLogs(level="ERROR") as error_log:
+ response = self.client_post("/json/calls/constructorgroups/create")
+ self.assertIn("Constructor Groups API request failed", error_log.output[0])
+ self.assert_json_error(response, "Failed to create Constructor Groups call")
+
+ @responses.activate
+ def test_api_response_json_error(self) -> None:
+ responses.add(
+ responses.POST,
+ f"{self.base_api_url}/room/default",
+ body="invalid json",
+ status=200,
+ )
+
+ with self.assertLogs(level="ERROR") as error_log:
+ response = self.client_post("/json/calls/constructorgroups/create")
+ self.assertIn("Constructor Groups API request failed", error_log.output[0])
+ self.assert_json_error(response, "Failed to create Constructor Groups call")
+
+ @responses.activate
+ def test_request_contains_correct_data(self) -> None:
+ responses.add(
+ responses.POST,
+ f"{self.base_api_url}/room/default",
+ json=self.mock_valid_room,
+ status=200,
+ )
+
+ response = self.client_post("/json/calls/constructorgroups/create")
+ self.assert_json_success(response)
+
+ # Verify request body
+ assert responses.calls[0].request.body is not None
+ request_body = orjson.loads(responses.calls[0].request.body)
+ self.assertEqual(request_body["creator_email"], self.user_profile.delivery_email)
+ self.assertEqual(request_body["name"], f"{self.user_profile.full_name}'s Zulip room")
+ self.assertEqual(
+ request_body["fallback_name"],
+ f"{self.user_profile.full_name}'s Zulip room ({self.user_profile.realm_id}-{self.user_profile.id})",
+ )
+
+ def test_unsupported_http_method(self) -> None:
+ from zerver.lib.exceptions import JsonableError
+ from zerver.views.video_calls import ConstructorGroupsService
+
+ service = ConstructorGroupsService()
+
+ with self.assertLogs(level="ERROR") as error_log:
+ with self.assertRaises(JsonableError) as cm:
+ service._make_authenticated_request("GET", "/room/default")
+ self.assertEqual(str(cm.exception.msg), "Failed to create Constructor Groups call")
+ self.assertIn("Constructor Groups API request failed", error_log.output[0])
diff --git a/zerver/tests/test_realm.py b/zerver/tests/test_realm.py
index 084a0420dff..69763c6eeb4 100644
--- a/zerver/tests/test_realm.py
+++ b/zerver/tests/test_realm.py
@@ -1319,6 +1319,33 @@ class RealmTest(ZulipTestCase):
zoom_server_to_server_provider_id,
)
+ constructor_groups_provider_id = Realm.VIDEO_CHAT_PROVIDERS["constructor_groups"]["id"]
+ req = {"video_chat_provider": f"{constructor_groups_provider_id}"}
+ with self.settings(CONSTRUCTOR_GROUPS_URL=None):
+ result = self.client_patch("/json/realm", req)
+ self.assert_json_error(
+ result, f"Invalid video_chat_provider {constructor_groups_provider_id}"
+ )
+
+ with self.settings(CONSTRUCTOR_GROUPS_ACCESS_KEY=None):
+ result = self.client_patch("/json/realm", req)
+ self.assert_json_error(
+ result, f"Invalid video_chat_provider {constructor_groups_provider_id}"
+ )
+
+ with self.settings(CONSTRUCTOR_GROUPS_SECRET_KEY=None):
+ result = self.client_patch("/json/realm", req)
+ self.assert_json_error(
+ result, f"Invalid video_chat_provider {constructor_groups_provider_id}"
+ )
+
+ result = self.client_patch("/json/realm", req)
+ self.assert_json_success(result)
+ self.assertEqual(
+ get_realm("zulip").video_chat_provider,
+ constructor_groups_provider_id,
+ )
+
def test_data_deletion_schedule_when_deactivating_realm(self) -> None:
self.login("desdemona")
diff --git a/zerver/views/video_calls.py b/zerver/views/video_calls.py
index 28a0a5c791d..dd45ce86192 100644
--- a/zerver/views/video_calls.py
+++ b/zerver/views/video_calls.py
@@ -73,6 +73,71 @@ class UnknownZoomUserError(JsonableError):
super().__init__(_("Unknown Zoom user email"))
+class ConstructorGroupsService:
+ def __init__(self) -> None:
+ if not self._is_configured():
+ raise CreateVideoCallFailedError("Constructor Groups")
+
+ self.access_key = settings.CONSTRUCTOR_GROUPS_ACCESS_KEY
+ self.secret_key = settings.CONSTRUCTOR_GROUPS_SECRET_KEY
+ self.base_url = (
+ settings.CONSTRUCTOR_GROUPS_URL.rstrip("/") if settings.CONSTRUCTOR_GROUPS_URL else ""
+ )
+
+ @staticmethod
+ def _is_configured() -> bool:
+ return (
+ settings.CONSTRUCTOR_GROUPS_URL is not None
+ and settings.CONSTRUCTOR_GROUPS_ACCESS_KEY is not None
+ and settings.CONSTRUCTOR_GROUPS_SECRET_KEY is not None
+ )
+
+ def _make_authenticated_request(
+ self, method: str, endpoint: str, data: dict[str, Any] | None = None
+ ) -> dict[str, Any]:
+ """Make authenticated request to Constructor Groups XAPI"""
+ url = f"{self.base_url}{endpoint}"
+
+ # Construct authentication token: ACCESS_KEY|SHA256(ACCESS_KEY|SECRET_KEY)
+ combined_string = f"{self.access_key}|{self.secret_key}"
+ hash_hex = hashlib.sha256(combined_string.encode("utf-8")).hexdigest()
+ auth_token = f"{self.access_key}|{hash_hex}"
+
+ headers = {
+ "Authorization": f"Bearer {auth_token}",
+ "Content-Type": "application/json",
+ }
+
+ try:
+ session = VideoCallSession()
+ if method.upper() == "POST":
+ response = session.post(url, headers=headers, json=data or {})
+ else:
+ raise ValueError(f"Unsupported HTTP method: {method}")
+
+ response.raise_for_status()
+ return response.json()
+ except requests.HTTPError as e:
+ logging.exception(
+ "Constructor Groups API request failed with status %s", e.response.status_code
+ )
+ raise CreateVideoCallFailedError("Constructor Groups")
+ except Exception:
+ logging.exception("Constructor Groups API request failed")
+ raise CreateVideoCallFailedError("Constructor Groups")
+
+ def get_or_create_default_room(
+ self, creator_email: str, name: str, fallback_name: str
+ ) -> dict[str, Any]:
+ data = {
+ "creator_email": creator_email,
+ "name": name,
+ "fallback_name": fallback_name,
+ }
+
+ return self._make_authenticated_request("POST", "/room/default", data)
+
+
class OAuthVideoCallProvider(ABC):
provider_name: str = NotImplemented
client_id: str | None = NotImplemented
@@ -466,3 +531,24 @@ def join_bigbluebutton(request: HttpRequest, *, bigbluebutton: str) -> HttpRespo
settings.BIG_BLUE_BUTTON_URL + "api/join", join_params
)
return redirect(append_url_query_string(redirect_url_base, "checksum=" + checksum))
+
+
+@typed_endpoint_without_parameters
+def make_constructor_groups_video_call(
+ request: HttpRequest,
+ user_profile: UserProfile,
+) -> HttpResponse:
+ service = ConstructorGroupsService()
+
+ room_data = service.get_or_create_default_room(
+ creator_email=user_profile.delivery_email,
+ name=f"{user_profile.full_name}'s Zulip room",
+ fallback_name=f"{user_profile.full_name}'s Zulip room ({user_profile.realm_id}-{user_profile.id})",
+ )
+
+ room_url = room_data.get("url", "")
+ if not room_url:
+ logging.error("Constructor Groups API returned room without URL: %s", room_data)
+ raise CreateVideoCallFailedError("Constructor Groups")
+
+ return json_success(request, {"url": room_url})
diff --git a/zproject/computed_settings.py b/zproject/computed_settings.py
index d8bd8761189..db534301f8c 100644
--- a/zproject/computed_settings.py
+++ b/zproject/computed_settings.py
@@ -532,6 +532,9 @@ DROPBOX_APP_KEY = get_secret("dropbox_app_key")
BIG_BLUE_BUTTON_SECRET = get_secret("big_blue_button_secret")
+CONSTRUCTOR_GROUPS_ACCESS_KEY = get_secret("constructor_groups_access_key")
+CONSTRUCTOR_GROUPS_SECRET_KEY = get_secret("constructor_groups_secret_key")
+
# These are the bots that Zulip sends automated messages as.
INTERNAL_BOTS = [
{
diff --git a/zproject/default_settings.py b/zproject/default_settings.py
index 82ed8460017..dc9b638d22d 100644
--- a/zproject/default_settings.py
+++ b/zproject/default_settings.py
@@ -195,6 +195,9 @@ TENOR_API_KEY = get_secret("tenor_api_key")
# development; this is useful since there are no public BigBlueButton servers.
BIG_BLUE_BUTTON_URL = get_secret("big_blue_button_url", development_only=True)
+# Allow setting Constructor Groups URL in development.
+CONSTRUCTOR_GROUPS_URL = get_secret("constructor_groups_url", development_only=True)
+
# Max state storage per user
# TODO: Add this to zproject/prod_settings_template.py once stateful bots are fully functional.
USER_STATE_SIZE_LIMIT = 10000000
diff --git a/zproject/prod_settings_template.py b/zproject/prod_settings_template.py
index d88eb5bcdb0..26af19c67ad 100644
--- a/zproject/prod_settings_template.py
+++ b/zproject/prod_settings_template.py
@@ -744,6 +744,12 @@ SOCIAL_AUTH_SAML_SUPPORT_CONTACT = {
## set big_blue_button_secret in zulip-secrets.conf.
# BIG_BLUE_BUTTON_URL = "https://bbb.example.com/bigbluebutton/"
+## Controls the Constructor Groups video call integration. You must also
+## set constructor_groups_access_key and constructor_groups_secret_key in
+## zulip-secrets.conf.
+# CONSTRUCTOR_GROUPS_URL = "https://example.constructor.app/api/groups/xapi"
+
+
################
## AI Features
##
diff --git a/zproject/test_extra_settings.py b/zproject/test_extra_settings.py
index 6a81ba501c8..d3af39542c9 100644
--- a/zproject/test_extra_settings.py
+++ b/zproject/test_extra_settings.py
@@ -202,6 +202,10 @@ VIDEO_ZOOM_CLIENT_SECRET = "client_secret"
BIG_BLUE_BUTTON_SECRET = "123"
BIG_BLUE_BUTTON_URL = "https://bbb.example.com/bigbluebutton/"
+CONSTRUCTOR_GROUPS_URL = "https://example.constructor.app/api/groups/xapi"
+CONSTRUCTOR_GROUPS_ACCESS_KEY = "test-access-key"
+CONSTRUCTOR_GROUPS_SECRET_KEY = "test-secret-key"
+
# By default two factor authentication is disabled in tests.
# Explicitly set this to True within tests that must have this on.
TWO_FACTOR_AUTHENTICATION_ENABLED = False
diff --git a/zproject/urls.py b/zproject/urls.py
index 0901f7ec40a..52f0b940fa3 100644
--- a/zproject/urls.py
+++ b/zproject/urls.py
@@ -271,6 +271,7 @@ from zerver.views.video_calls import (
deauthorize_zoom_user,
get_bigbluebutton_url,
join_bigbluebutton,
+ make_constructor_groups_video_call,
make_zoom_video_call,
register_zoom_user,
)
@@ -598,6 +599,8 @@ v1_api_and_json_patterns = [
rest_path("calls/zoom/create", POST=make_zoom_video_call),
# Used to generate a BigBlueButton video call URL
rest_path("calls/bigbluebutton/create", GET=get_bigbluebutton_url),
+ # Used to generate a Constructor Groups video call URL
+ rest_path("calls/constructorgroups/create", POST=make_constructor_groups_video_call),
# export/realm -> zerver.views.realm_export
rest_path("export/realm", POST=export_realm, GET=get_realm_exports),
rest_path("export/realm/<int:export_id>", DELETE=delete_realm_export),