From 6bb917032d6f6f49437dc8ce5538f5a4dd407d36 Mon Sep 17 00:00:00 2001 From: Teddy Arida-Moody Date: Wed, 4 Nov 2026 13:29:18 -0800 Subject: [PATCH 1/4] Remove testing environment references from socket mode sample Use the production socket mode defaults, remove testing-ring guidance, and use a placeholder hostname in adapter tests. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- examples/socket/README.md | 7 +------ examples/socket/src/main.py | 9 +-------- packages/apps/tests/test_socket_mode_adapter.py | 8 ++++---- 3 files changed, 6 insertions(+), 18 deletions(-) diff --git a/examples/socket/README.md b/examples/socket/README.md index 5860385b..a8bc9e10 100644 --- a/examples/socket/README.md +++ b/examples/socket/README.md @@ -21,7 +21,7 @@ Socket Mode bots should not be submitted to Marketplace for publishing. - **Enabling Socket Mode** — `App(socket_mode=True)` for WebSocket inbound delivery with no HTTP endpoint. - **Multi-geo by default** — a single bot opens one connection per geo (`amer`, `emea`, `apac`) so it has inbound coverage across regions. Override - with `geos=[...]` or point at a custom ring with `negotiate_base_url`. + with `geos=[...]`. - **Lifecycle events** — subscribing to `app.socket_mode.events` for `ready`, `disconnected`, and `reconnected`. Each event carries the `geo` it relates to, since connections are per geo. Reconnects are automatic when `terminal=False`. @@ -60,10 +60,5 @@ You should see per-geo `ready` logs as each connection comes up, then `you said - **No HTTP surface** — tabs, remote functions, OAuth callbacks, and other browser routes are unavailable in Socket Mode. -- **Canary and Pilot1 endpoints** — Socket Mode is currently available only on - the Canary (`https://canary.botapi.skype.com`) and Pilot1 - (`https://pilot1.botapi.skype.com`) rings; the production default returns - 503. The sample sets `negotiate_base_url` to the canary ring, but Pilot1 works - too. Remove the override when production is enabled. - **Classic bot identity only** — Socket Mode connects with the bot's MSA App Id. Agentic identities are not supported today. diff --git a/examples/socket/src/main.py b/examples/socket/src/main.py index 36263f12..07c91ebc 100644 --- a/examples/socket/src/main.py +++ b/examples/socket/src/main.py @@ -13,7 +13,6 @@ ActivityContext, App, SocketModeDisconnectedEvent, - SocketModeOptions, SocketModeReadyEvent, SocketModeReconnectedEvent, ) @@ -25,13 +24,7 @@ logging.getLogger("microsoft_teams.apps.socket_mode").setLevel(logging.DEBUG) logger = logging.getLogger(__name__) -app = App( - socket_mode=SocketModeOptions( - # Socket Mode is only available on the Canary and Pilot1 rings for now. - # Pilot1 (https://pilot1.botapi.skype.com) is supported as well. - negotiate_base_url="https://canary.botapi.skype.com", - ) -) +app = App(socket_mode=True) # Handlers are transport-agnostic: the exact same code works over HTTP or Socket Mode. diff --git a/packages/apps/tests/test_socket_mode_adapter.py b/packages/apps/tests/test_socket_mode_adapter.py index c8cffb31..1522f76e 100644 --- a/packages/apps/tests/test_socket_mode_adapter.py +++ b/packages/apps/tests/test_socket_mode_adapter.py @@ -442,13 +442,13 @@ def test_options_defaults_preserve_transport_policy(): def test_options_map_onto_transport_options(): geos = ["amer"] options = SocketModeOptions( - negotiate_base_url="https://canary.botapi.skype.com", + negotiate_base_url="https://botapi.example", geos=geos, ) transport_options = options.to_transport_options() geos.append("emea") - assert transport_options.negotiate_base_url == "https://canary.botapi.skype.com" + assert transport_options.negotiate_base_url == "https://botapi.example" assert transport_options.geos == ("amer",) @@ -532,12 +532,12 @@ def test_app_socket_mode_options_are_honoured(): client_id="client", client_secret="secret", tenant_id="tenant", - socket_mode=SocketModeOptions(negotiate_base_url="https://canary.botapi.skype.com", geos=("amer",)), + socket_mode=SocketModeOptions(negotiate_base_url="https://botapi.example", geos=("amer",)), ) assert app.socket_mode is not None assert app.socket_mode.geo_list == ("amer",) - assert app.socket_mode.negotiate_url == "https://canary.botapi.skype.com/amer/v3/websockets/connect" + assert app.socket_mode.negotiate_url == "https://botapi.example/amer/v3/websockets/connect" def test_app_rejects_socket_mode_with_a_custom_http_adapter(): From 3e61f8cb1815041f02103782d3607ccf7432f54c Mon Sep 17 00:00:00 2001 From: Teddy Arida-Moody Date: Wed, 4 Nov 2026 17:37:31 -0800 Subject: [PATCH 2/4] Clarify Socket Mode configuration and new-bot guidance Document geo and endpoint overrides in API docstrings, recommend Socket Mode for new bots, and remove override guidance from the sample README. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- examples/socket/README.md | 3 +-- packages/apps/src/microsoft_teams/apps/app.py | 2 ++ packages/apps/src/microsoft_teams/apps/options.py | 4 ++++ .../src/microsoft_teams/apps/socket_mode/adapter.py | 12 ++++++++++-- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/examples/socket/README.md b/examples/socket/README.md index a8bc9e10..36fefad5 100644 --- a/examples/socket/README.md +++ b/examples/socket/README.md @@ -20,8 +20,7 @@ Socket Mode bots should not be submitted to Marketplace for publishing. - **Enabling Socket Mode** — `App(socket_mode=True)` for WebSocket inbound delivery with no HTTP endpoint. - **Multi-geo by default** — a single bot opens one connection per geo - (`amer`, `emea`, `apac`) so it has inbound coverage across regions. Override - with `geos=[...]`. + (`amer`, `emea`, `apac`) so it has inbound coverage across regions. - **Lifecycle events** — subscribing to `app.socket_mode.events` for `ready`, `disconnected`, and `reconnected`. Each event carries the `geo` it relates to, since connections are per geo. Reconnects are automatic when `terminal=False`. diff --git a/packages/apps/src/microsoft_teams/apps/app.py b/packages/apps/src/microsoft_teams/apps/app.py index a6eb7e4d..5dd8d252 100644 --- a/packages/apps/src/microsoft_teams/apps/app.py +++ b/packages/apps/src/microsoft_teams/apps/app.py @@ -221,6 +221,8 @@ def socket_mode(self) -> Optional[SocketModeAdapter]: """The experimental Socket Mode adapter when enabled, else ``None``. Exposes ``status``, ``geo_statuses``, and ``events`` for observing the connection. + Socket Mode is recommended for new bots; existing bots may require + additional configuration. This API is in preview and may change in the future; recommended only for development. Diagnostic: ExperimentalTeamsSocketMode """ diff --git a/packages/apps/src/microsoft_teams/apps/options.py b/packages/apps/src/microsoft_teams/apps/options.py index ab5fdf1d..09a270b1 100644 --- a/packages/apps/src/microsoft_teams/apps/options.py +++ b/packages/apps/src/microsoft_teams/apps/options.py @@ -125,6 +125,8 @@ class AppOptions(TypedDict, total=False): have no listener to serve them. Mutually exclusive with ``http_server_adapter``, and supported only in the public cloud. + Socket Mode is recommended for new bots; existing bots may require + additional configuration. This API is in preview and may change in the future; recommended only for development. Diagnostic: ExperimentalTeamsSocketMode """ @@ -240,6 +242,8 @@ class InternalAppOptions: socket_mode: Optional[Union[bool, SocketModeOptions]] = None """Experimental: receive activities over an outbound WebSocket instead of an inbound HTTPS endpoint. + Socket Mode is recommended for new bots; existing bots may require + additional configuration. This API is in preview and may change in the future; recommended only for development. Diagnostic: ExperimentalTeamsSocketMode """ diff --git a/packages/apps/src/microsoft_teams/apps/socket_mode/adapter.py b/packages/apps/src/microsoft_teams/apps/socket_mode/adapter.py index b5f48f21..0986c875 100644 --- a/packages/apps/src/microsoft_teams/apps/socket_mode/adapter.py +++ b/packages/apps/src/microsoft_teams/apps/socket_mode/adapter.py @@ -82,15 +82,21 @@ class SocketModeOptions: Preview configuration for the Socket Mode negotiate URL and geographies; may change in the future. WebSocket is only recommended for use when developing agents. + Socket Mode is recommended for new bots; existing bots may require + additional configuration. Diagnostic: ExperimentalTeamsSocketMode """ negotiate_base_url: str = DEFAULT_SOCKET_MODE_NEGOTIATE_BASE_URL - """Service host used to negotiate the connection.""" + """ + Service host used to negotiate the connection. Defaults to ``https://botapi.skype.com``. + Override this to target a different Teams backend service ring. + """ geos: Sequence[str] = DEFAULT_GEOS """ - Geographies to connect, one independent socket each. Every one must connect for + Geographies to connect, one independent socket each. Defaults to ``("amer", "emea", "apac")``; + override this to select the geographies to connect to. Every one must connect for ``start()`` to succeed, after which each is supervised on its own. """ @@ -140,6 +146,8 @@ class SocketModeAdapter: This API is in preview and may change in the future. WebSocket is only recommended for use when developing agents. + Socket Mode is recommended for new bots; existing bots may require + additional configuration. Diagnostic: ExperimentalTeamsSocketMode """ From 75652b215efd5b9273d8cd5af7554127673f1571 Mon Sep 17 00:00:00 2001 From: Teddy Arida-Moody Date: Thu, 5 Nov 2026 09:51:32 -0800 Subject: [PATCH 3/4] Clarify Socket Mode availability for new bots Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- packages/apps/src/microsoft_teams/apps/app.py | 3 +-- packages/apps/src/microsoft_teams/apps/options.py | 6 ++---- .../apps/src/microsoft_teams/apps/socket_mode/adapter.py | 6 ++---- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/packages/apps/src/microsoft_teams/apps/app.py b/packages/apps/src/microsoft_teams/apps/app.py index 5dd8d252..a1385597 100644 --- a/packages/apps/src/microsoft_teams/apps/app.py +++ b/packages/apps/src/microsoft_teams/apps/app.py @@ -221,8 +221,7 @@ def socket_mode(self) -> Optional[SocketModeAdapter]: """The experimental Socket Mode adapter when enabled, else ``None``. Exposes ``status``, ``geo_statuses``, and ``events`` for observing the connection. - Socket Mode is recommended for new bots; existing bots may require - additional configuration. + Socket Mode is currently only available for new bots. This API is in preview and may change in the future; recommended only for development. Diagnostic: ExperimentalTeamsSocketMode """ diff --git a/packages/apps/src/microsoft_teams/apps/options.py b/packages/apps/src/microsoft_teams/apps/options.py index 09a270b1..5c264fd1 100644 --- a/packages/apps/src/microsoft_teams/apps/options.py +++ b/packages/apps/src/microsoft_teams/apps/options.py @@ -125,8 +125,7 @@ class AppOptions(TypedDict, total=False): have no listener to serve them. Mutually exclusive with ``http_server_adapter``, and supported only in the public cloud. - Socket Mode is recommended for new bots; existing bots may require - additional configuration. + Socket Mode is currently only available for new bots. This API is in preview and may change in the future; recommended only for development. Diagnostic: ExperimentalTeamsSocketMode """ @@ -242,8 +241,7 @@ class InternalAppOptions: socket_mode: Optional[Union[bool, SocketModeOptions]] = None """Experimental: receive activities over an outbound WebSocket instead of an inbound HTTPS endpoint. - Socket Mode is recommended for new bots; existing bots may require - additional configuration. + Socket Mode is currently only available for new bots. This API is in preview and may change in the future; recommended only for development. Diagnostic: ExperimentalTeamsSocketMode """ diff --git a/packages/apps/src/microsoft_teams/apps/socket_mode/adapter.py b/packages/apps/src/microsoft_teams/apps/socket_mode/adapter.py index 0986c875..4d1d2709 100644 --- a/packages/apps/src/microsoft_teams/apps/socket_mode/adapter.py +++ b/packages/apps/src/microsoft_teams/apps/socket_mode/adapter.py @@ -82,8 +82,7 @@ class SocketModeOptions: Preview configuration for the Socket Mode negotiate URL and geographies; may change in the future. WebSocket is only recommended for use when developing agents. - Socket Mode is recommended for new bots; existing bots may require - additional configuration. + Socket Mode is currently only available for new bots. Diagnostic: ExperimentalTeamsSocketMode """ @@ -146,8 +145,7 @@ class SocketModeAdapter: This API is in preview and may change in the future. WebSocket is only recommended for use when developing agents. - Socket Mode is recommended for new bots; existing bots may require - additional configuration. + Socket Mode is currently only available for new bots. Diagnostic: ExperimentalTeamsSocketMode """ From efbc40ddfe36c1b45b1025845d001d36887cf203 Mon Sep 17 00:00:00 2001 From: teddy arida-moody <113314164+teddyam@users.noreply.github.com> Date: Thu, 5 Nov 2026 10:01:27 -0800 Subject: [PATCH 4/4] Revise Socket Mode section in README Updated README to clarify Socket Mode features and usage. Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- examples/socket/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/socket/README.md b/examples/socket/README.md index 36fefad5..a4d20834 100644 --- a/examples/socket/README.md +++ b/examples/socket/README.md @@ -21,6 +21,7 @@ Socket Mode bots should not be submitted to Marketplace for publishing. - **Enabling Socket Mode** — `App(socket_mode=True)` for WebSocket inbound delivery with no HTTP endpoint. - **Multi-geo by default** — a single bot opens one connection per geo (`amer`, `emea`, `apac`) so it has inbound coverage across regions. +- **New bots only** — Socket Mode is currently available only for new bots. - **Lifecycle events** — subscribing to `app.socket_mode.events` for `ready`, `disconnected`, and `reconnected`. Each event carries the `geo` it relates to, since connections are per geo. Reconnects are automatic when `terminal=False`.