Python client for the sam.gov opportunities API: https://open.gsa.gov/api/get-opportunities-public-api/. Searches by a list of NAICS codes and from-date, defaulting to a list of opps from the past day.
The SAM-Search-Run workflow pulls search results for specified NAICS each day and posts to a designated MS Teams channel. Search config data is stored in config.yaml. To run this you must obtain and configure as actions repo secrets:
- SAM_API_KEY: API key from sam.gov, which is tied to a personal account, and expires every 90 days.
- MS_URL: MS Teams webhook URL for your organization.
More info on setting up Teams webhooks: Create incoming webhooks with Workflows for Microsoft Teams
Note
The sam.gov get opportunities API does not allow searching by a list of NAICS like the front-end sam.gov web page does, so this client is making a series of GET requests for each NAICS configured in config.yaml. Sam.gov restricts non-federal accounts to 10 API requests per day, so this can only search a max of 10 NAICS per day. MS Teams also restricts the size of posted messages, so search results with over 40 records will be broken into additional Teams messages.
Python 3.13+ required. Install uv (brew install uv) and sync dependencies:
uv sync --devLint:
uv run ruff check .
uv run ruff format --check .Git hook (auto-formats Python files on commit):
git config core.hooksPath hooksType check:
uv run ty checkTests:
uv run pytest test_search.pyExecute: pass sam api key, ms teams webhook url:
uv run python3 search.py my-sam-api-key my-ms-webhook-url