A Python sample that uses WDM, a WebSocket event stream, and documented
Webex REST APIs (Rooms, Memberships) to hide or leave messaging
spaces whose titles match a configurable regex block list, when hide_direct
or leave_group_spaces is enabled in YAML—useful for noisy bot or notification spaces in the
Webex app.
Why use this playbook
- Faster delivery: Start from working asyncio + wxc-sdk patterns instead of rediscovering device registration and WebSocket auth.
- Clear behavior: Shows how conversation.activity events map to Rooms and Memberships updates for direct vs group spaces.
- Secrets via env: Client ID, client secret, and scopes load from
environment variables (see
src/env.template). - Ops-friendly toggles: YAML config separates hide_direct, leave_group_spaces, and blocked regexes so you can start read-only-safe.
What it does
- Registers or reuses a WDM desktop device and opens the WebSocket URL returned by the service.
- Parses conversation.activity payloads (verbs post, or add when you are added), resolves the space title, and compares it to anchored full-string regex entries; ignores activities you authored yourself.
- Calls Memberships APIs to hide 1:1 spaces or leave group spaces only when
hide_directorleave_group_spacesis true in YAML (both default false in the sample). - Persists OAuth tokens to a local YAML cache file and runs a refresh loop so the WebSocket stays authorized.
Preview listing
This App Hub entry was published from an open pull request. Review the change.
Support
Third-Party Tool
—
Estimated Implementation Time
2-4 hours
Categories
A Python sample that uses WDM, a WebSocket event stream, and documented
Webex REST APIs (Rooms, Memberships) to hide or leave messaging
spaces whose titles match a configurable regex block list, when hide_direct
or leave_group_spaces is enabled in YAML—useful for noisy bot or notification spaces in the
Webex app.
Why use this playbook
- Faster delivery: Start from working asyncio + wxc-sdk patterns instead of rediscovering device registration and WebSocket auth.
- Clear behavior: Shows how conversation.activity events map to Rooms and Memberships updates for direct vs group spaces.
- Secrets via env: Client ID, client secret, and scopes load from
environment variables (see
src/env.template). - Ops-friendly toggles: YAML config separates hide_direct, leave_group_spaces, and blocked regexes so you can start read-only-safe.
What it does
- Registers or reuses a WDM desktop device and opens the WebSocket URL returned by the service.
- Parses conversation.activity payloads (verbs post, or add when you are added), resolves the space title, and compares it to anchored full-string regex entries; ignores activities you authored yourself.
- Calls Memberships APIs to hide 1:1 spaces or leave group spaces only when
hide_directorleave_group_spacesis true in YAML (both default false in the sample). - Persists OAuth tokens to a local YAML cache file and runs a refresh loop so the WebSocket stays authorized.
Preview listing
This App Hub entry was published from an open pull request. Review the change.