CLI
The Spoteamfy CLI fetches recently played tracks from Spotify for configured users and posts formatted adaptive cards to Microsoft Teams via webhook.
Usage
python -m spoteamfy.src.cli [OPTIONS]
Options
Option | Type | Default | Description |
---|---|---|---|
--num-tracks |
INTEGER | 5 | Number of recently played tracks to fetch per user (max 50) |
--users-json |
PATH | ./config/users.json |
Path to JSON file with user credentials. Must exist. |
--teams-webhook |
TEXT | Environment variable | Teams webhook URL for posting track info |
Configuration Priority
Users JSON File
--users-json
CLI argumentUSERS_JSON_PATH
environment variable./config/users.json
(default)
Teams Webhook URL
--teams-webhook
CLI argumentWEBHOOK_URL
environment variable- Error if neither provided
Examples
Basic usage (uses defaults)
python -m spoteamfy.src.cli
Fetch 10 tracks with custom webhook
python -m spoteamfy.src.cli --num-tracks 10 --teams-webhook "https://your-webhook-url"
Custom users file
python -m spoteamfy.src.cli --users-json "/path/to/users.json" --num-tracks 3
Environment Setup
Create a .env
file in the project root:
USERS_JSON_PATH=./config/users.json
WEBHOOK_URL=https://your-teams-webhook-url
Output
The CLI creates adaptive cards with: - Album cover art from the most recent track - Track list with clickable Spotify links - User-friendly formatting for Teams channels
Exit Codes
0
- Success (even if some posts fail)- Errors are reported but don't cause exit code changes