{"id":30185265,"url":"https://github.com/webexsamples/webex-byods-manager","last_synced_at":"2025-08-12T13:52:55.320Z","repository":{"id":306149333,"uuid":"1024548705","full_name":"WebexSamples/webex-byods-manager","owner":"WebexSamples","description":null,"archived":false,"fork":false,"pushed_at":"2025-08-06T18:25:56.000Z","size":1736,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-06T20:31:50.692Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/WebexSamples.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-22T22:04:08.000Z","updated_at":"2025-07-23T21:25:34.000Z","dependencies_parsed_at":"2025-07-24T00:09:00.034Z","dependency_job_id":"4e9b2ed0-4b3d-460e-bd50-958014ce636f","html_url":"https://github.com/WebexSamples/webex-byods-manager","commit_stats":null,"previous_names":["webexsamples/webex-byods-manager"],"tags_count":0,"template":false,"template_full_name":"WebexSamples/Webex-Samples-Template","purl":"pkg:github/WebexSamples/webex-byods-manager","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebexSamples%2Fwebex-byods-manager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebexSamples%2Fwebex-byods-manager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebexSamples%2Fwebex-byods-manager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebexSamples%2Fwebex-byods-manager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WebexSamples","download_url":"https://codeload.github.com/WebexSamples/webex-byods-manager/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebexSamples%2Fwebex-byods-manager/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270072031,"owners_count":24522354,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-12T02:00:09.011Z","response_time":80,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-08-12T13:52:54.346Z","updated_at":"2025-08-12T13:52:55.287Z","avatar_url":"https://github.com/WebexSamples.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Webex BYO Data Source Management\n\nThis script manages [Webex BYODS (Bring Your Own Data Source)](https://developer.webex.com/create/docs/bring-your-own-datasource) system using the Webex Admin API.\n\n## Vidcast\n\n[![Vidcast](image.png)\nWatch the Vidcast of this app](https://app.vidcast.io/share/63e954e4-f0ae-4c20-82c3-c666cda6aad3?playerMode=vidcast)\n\n## Main Script\n\n**`data-sources.py`** - Unified interface for all data source operations including:\n\n- Listing and viewing existing data sources\n- Registering new data sources\n- Updating existing data source configurations\n- Interactive menu-driven interface\n\n## Token Management\n\nThis project includes automated token refresh functionality to handle service app token expiration:\n\n**Files:**\n\n- **`token_manager.py`** - Core token management class with smart refresh logic\n- **`refresh_token.py`** - Standalone script for manual token refresh\n- **`TOKEN_MANAGEMENT.md`** - Complete setup and usage documentation\n\n**Key Features:**\n\n- **Smart refresh strategy**: Uses refresh tokens when available, falls back to personal access tokens\n- **OAuth support**: Automatic refresh of personal access tokens via OAuth (optional)\n- **Automatic validation**: Checks token validity before operations\n- **Seamless integration**: Automatically refreshes tokens in the main data-sources.py script\n- **Multiple setup options**: Portal tokens, integration tokens, or full OAuth automation\n\n**Quick Token Refresh:**\n\n```bash\n# Activate virtual environment\nsource venv/bin/activate\n\n# Manually refresh tokens\npython refresh_token.py\n\n# Set up OAuth for automatic personal token refresh (optional)\npython setup_oauth.py\n```\n\nFor complete setup instructions, see [TOKEN_MANAGEMENT.md](TOKEN_MANAGEMENT.md).\n\n## Requirements\n\n- Python 3.6 or higher\n- A Webex Service App with appropriate scopes:\n  - `spark-admin:datasource_write` (for registration and updates)\n  - `spark-admin:datasource_read` (for listing/viewing)\n- Access token from your Service App\n\n## Setup\n\n1. Create and activate a virtual environment (recommended):\n\n   ```bash\n   python3 -m venv venv\n   source venv/bin/activate  # On Windows: venv\\Scripts\\activate\n   ```\n\n2. Install the required dependencies:\n\n   ```bash\n   pip install -r requirements.txt\n   ```\n\n3. Configure your access token:\n\n   - Copy the sample environment file: `cp .env.sample .env`\n   - Edit the `.env` file and replace `your_service_app_token_here` with your actual Service App access token (stored as `WEBEX_SERVICE_APP_ACCESS_TOKEN`)\n\n4. **Optional**: Set up automated token refresh (recommended for production):\n   - Copy the token configuration template: `cp token-config.json.template token-config.json`\n   - Edit `token-config.json` with your service app and token manager credentials\n   - See [TOKEN_MANAGEMENT.md](TOKEN_MANAGEMENT.md) for detailed setup instructions\n\n## Usage\n\nRun the data source manager:\n\n```bash\npython data-sources.py\n```\n\n**Features:**\n\n- Automatically loads and displays all your data sources on startup\n- **Automated token refresh**: Automatically refreshes expired service app tokens\n- Interactive menu to view/update existing data sources or register new ones\n- **Schema-aware interface**: Automatically fetches and displays available schemas with friendly service type names\n- Real-time refresh capability\n- Unified interface for all operations\n- Saves operation records automatically\n- JWT token decoding for enhanced data source details\n\n**Menu Options:**\n\n1. **View/Update Data Sources**: Select any data source to view details and optionally update\n2. **Register New Data Source**: Create a new data source with guided prompts\n3. **Refresh Data Sources List**: Reload the current list from the API\n4. **Quit**: Exit the application\n\n**Optional Flags:**\n\n```bash\n# Save the initial data sources list to a JSON file\npython data-sources.py --save-list\n```\n\n### Registration Process\n\nWhen registering a new data source, the script will prompt for:\n\n- **Audience**: The audience field in the JWT token (default: \"BYODS\")\n- **Nonce**: Unique nonce used in the encryption of the JWT token (default: auto-generated UUID)\n- **Schema Selection**: Interactive menu showing available schemas with service type names and descriptions (default schema provided)\n- **Subject**: The subject field in the JWT token (default: \"BYODS\")\n- **URL**: The URL of the endpoint where Webex will send the data (required, no default)\n- **Token Lifetime Minutes**: The validity of the created token in minutes (default: 1440, max 1440)\n\n**Note**: You can press Enter to accept the default values shown in brackets, or type a custom value to override the defaults.\n\n### Update Process\n\nWhen updating data sources, the process:\n\n- Pre-fills current values as defaults (press Enter to keep)\n- **Shows current schema with friendly service type name**\n- Requires a new nonce for security (auto-generated UUID provided)\n- Allows updating token lifetime, URL, audience, subject, schema selection, and status\n- **Interactive schema selection** with numbered menu of available options\n- Confirms changes before applying\n- Saves operation records to JSON files automatically\n\n## Documentation and Resources\n\n### Comprehensive BYODS Guide\n\n- [Bring Your Own Data Source - Complete Developer Guide](https://developer.webex.com/create/docs/bring-your-own-datasource) - Comprehensive guide covering the entire BYODS framework\n\n### Getting Started\n\n- [Service Apps Guide](https://developer.webex.com/docs/service-apps) - Learn how to create and configure Service Apps\n- [Webex Developer Portal](https://developer.webex.com/) - Create your Service App here\n- [Developer Sandbox Guide](https://developer.webex.com/docs/developer-sandbox-guide) - Set up a sandbox environment for testing\n- [Contact Center Sandbox](https://developer.webex-cx.com/sandbox) - For Contact Center specific use cases\n\n### API Documentation\n\n- [Register a Data Source](https://developer.webex.com/admin/docs/api/v1/data-sources/register-a-data-source)\n- [Retrieve All Data Sources](https://developer.webex.com/admin/docs/api/v1/data-sources/retrieve-all-data-sources)\n- [Retrieve Data Source Details](https://developer.webex.com/admin/docs/api/v1/data-sources/retrieve-data-source-details)\n- [Update a Data Source](https://developer.webex.com/admin/docs/api/v1/data-sources/update-a-data-source)\n- [Retrieve Data Source Schemas](https://developer.webex.com/admin/docs/api/v1/data-sources/retrieve-data-source-schemas) - Browse available schemas with service types and descriptions\n\n### Security and Authentication\n\n- [JWT Debugger](https://jwt.io) - Tool for inspecting JWS tokens\n- [JWS Token Verification Example (Java)](https://github.com/ralfschiffert/byodsJws) - Reference implementation for token validation\n- [Cisco Public Key Endpoints](https://idbroker.webex.com/idb/oauth2/v2/keys/verificationjwk/) - US endpoint for JWS verification\n- [EU Public Key Endpoint](https://idbroker-eu.webex.com/idb/oauth2/v2/keys/verificationjwk) - EU endpoint for JWS verification\n\n## Response and Output\n\nUpon successful operations, you'll receive:\n\n- Data Source ID (for registrations)\n- Status (active/disabled)\n- All configured parameters\n- Any error messages (if applicable)\n- Enhanced JWT token information (audience, subject, expiration)\n\nThe script automatically saves all operation details to JSON files:\n\n- **Successful registrations**: `data_source_registration_{ID}_{timestamp}.json`\n- **Successful updates**: `data_source_update_{ID}_{timestamp}.json`\n- **Failed operations**: `data_source_{operation}_failed_{timestamp}.json`\n- **Data source lists**: `data_sources_list_{timestamp}.json` (when using --save-list flag)\n- **Token configuration**: `token-config.json` (if using automated token refresh)\n\nThese files contain:\n\n- Operation timestamp\n- Original configuration used\n- Complete API response\n- Success/failure status\n\n**Note**: All JSON files are automatically excluded from git via `.gitignore` to protect sensitive information.\n\n## Authentication\n\nThe script requires a Service App access token with the following scopes:\n\n- **Registration and Updates**: `spark-admin:datasource_write`\n- **Listing/Viewing**: `spark-admin:datasource_read`\n\nFor full functionality, use a token that has both read and write scopes.\n\n**Token Management:**\n\n- Service app tokens are automatically refreshed when they expire\n- Refresh tokens are stored and used for efficient token renewal\n- Manual token refresh available via `python refresh_token.py`\n- See [TOKEN_MANAGEMENT.md](TOKEN_MANAGEMENT.md) for configuration details\n\n## Error Handling\n\nThe script includes comprehensive error handling for:\n\n- Missing or invalid access tokens\n- Network connection issues\n- API validation errors\n- Invalid input parameters\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebexsamples%2Fwebex-byods-manager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwebexsamples%2Fwebex-byods-manager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebexsamples%2Fwebex-byods-manager/lists"}