{"id":31280672,"url":"https://github.com/keyvaluesoftwaresystems/siren-py-sdk","last_synced_at":"2025-09-24T02:46:38.534Z","repository":{"id":313457478,"uuid":"1000621205","full_name":"KeyValueSoftwareSystems/siren-py-sdk","owner":"KeyValueSoftwareSystems","description":"Send notifications across SMS, email, push, Slack, chat, and more.","archived":false,"fork":false,"pushed_at":"2025-08-27T06:02:37.000Z","size":259,"stargazers_count":8,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-06T07:35:05.544Z","etag":null,"topics":["ai","messaging","notifications","python","sdk","siren"],"latest_commit_sha":null,"homepage":"https://trysiren.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KeyValueSoftwareSystems.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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-06-12T04:28:51.000Z","updated_at":"2025-08-21T10:26:59.000Z","dependencies_parsed_at":"2025-09-06T07:35:08.068Z","dependency_job_id":"b243f858-8498-48f6-bd33-1c5a1a1ac7fe","html_url":"https://github.com/KeyValueSoftwareSystems/siren-py-sdk","commit_stats":null,"previous_names":["keyvaluesoftwaresystems/siren-py-sdk"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/KeyValueSoftwareSystems/siren-py-sdk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KeyValueSoftwareSystems%2Fsiren-py-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KeyValueSoftwareSystems%2Fsiren-py-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KeyValueSoftwareSystems%2Fsiren-py-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KeyValueSoftwareSystems%2Fsiren-py-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KeyValueSoftwareSystems","download_url":"https://codeload.github.com/KeyValueSoftwareSystems/siren-py-sdk/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KeyValueSoftwareSystems%2Fsiren-py-sdk/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276683685,"owners_count":25685629,"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-09-24T02:00:09.776Z","response_time":97,"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":["ai","messaging","notifications","python","sdk","siren"],"created_at":"2025-09-24T02:46:36.877Z","updated_at":"2025-09-24T02:46:38.521Z","avatar_url":"https://github.com/KeyValueSoftwareSystems.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Siren Python SDK\n\nThis is the official Python SDK for the [Siren notification platform](https://docs.trysiren.io).\n\n## Table of Contents\n\n- [Installation](#installation)\n- [Basic Usage](#basic-usage)\n- [SDK Methods](#sdk-methods)\n- [Examples](#examples)\n- [For Package Developers](#for-package-developers)\n\n## Installation\n\n```bash\npip install trysiren\n```\n\n## Basic Usage\n\n### Synchronous\n```python\nfrom siren import SirenClient\n\n\n# Uses SIREN_API_KEY and SIREN_ENV environment variables\nclient = SirenClient()\n\n# Send a direct message without template\nmessage_id = client.message.send(\n    recipient_value=\"alice@company.com\",\n    channel=\"EMAIL\",\n    body=\"Your account has been successfully verified. You can now access all features.\"\n)\n\n# Send a message using a template\nmessage_id = client.message.send(\n    recipient_value=\"U01UBCD06BB\",\n    channel=\"SLACK\",\n    template_name=\"welcome_template\",\n    template_variables={\"user_name\": \"John\"},\n)\n\n# Send a message with specific provider\nfrom siren.models.messaging import ProviderCode\nmessage_id = client.message.send(\n    recipient_value=\"alice@company.com\",\n    channel=\"EMAIL\",\n    body=\"Your account has been successfully verified.\",\n    provider_name=\"email-provider\",\n    provider_code=ProviderCode.EMAIL_SENDGRID,\n)\n\n# Send a message using awesome template\nmessage_id = client.message.send_awesome_template(\n    recipient_value=\"U01UBCD06BB\",\n    channel=\"SLACK\",\n    template_identifier=\"awesome-templates/customer-support/escalation_required/official/casual.yaml\",\n    template_variables={\n        \"ticket_id\": \"123456\",\n        \"customer_name\": \"John\",\n        \"issue_summary\": \"Payment processing issue\",\n        \"ticket_url\": \"https://support.company.com/ticket/123456\",\n        \"sender_name\": \"Support Team\"\n    },\n    provider_name=\"slack-provider\",\n    provider_code=ProviderCode.SLACK,\n)\n```\n\n```python\n# You can also do:\nclient = SirenClient(api_key=\"YOUR_SIREN_API_KEY\") # default env is \"prod\"\n\n# Or:\nclient = SirenClient(api_key=\"YOUR_SIREN_API_KEY\", env=\"dev\")\n```\n\n### Asynchronous\n```python\nfrom siren import AsyncSirenClient\n\n# Using async context manager (recommended)\nasync with AsyncSirenClient() as client:\n    message_id = await client.message.send(\n        recipient_value=\"alice@company.com\",\n        channel=\"EMAIL\",\n        body=\"Your account has been successfully verified. You can now access all features.\"\n    )\n\n# Or manually managing the client\nclient = AsyncSirenClient()\ntry:\n    message_id = await client.message.send(\n        recipient_value=\"alice@company.com\",\n        channel=\"EMAIL\",\n        body=\"Your account has been successfully verified. You can now access all features.\"\n    )\nfinally:\n    await client.aclose()\n```\n\nAll synchronous methods have a 1-to-1 asynchronous equivalent—just `await` them on the async client.\n\n## SDK Methods\n\nThe Siren Python SDK provides a clean, namespaced interface to interact with the Siren API.\n\n**Templates** (`client.template.*`)\n- **`client.template.get()`** - Retrieves a list of notification templates with optional filtering, sorting, and pagination\n- **`client.template.create()`** - Creates a new notification template\n- **`client.template.update()`** - Updates an existing notification template\n- **`client.template.delete()`** - Deletes an existing notification template\n- **`client.template.publish()`** - Publishes a template, making its latest draft version live\n\n**Channel Templates** (`client.channel_template.*`)\n- **`client.channel_template.create()`** - Creates or updates channel-specific templates (EMAIL, SMS, etc.)\n- **`client.channel_template.get()`** - Retrieves channel templates for a specific template version\n\n**Messaging** (`client.message.*`)\n- **`client.message.send()`** - Sends a message (with or without a template) to a recipient via a chosen channel\n- **`client.message.send_awesome_template()`** - Sends a message using a template path/identifier\n- **`client.message.get_replies()`** - Retrieves replies for a specific message ID\n- **`client.message.get_status()`** - Retrieves the status of a specific message (SENT, DELIVERED, FAILED, etc.)\n\n**Workflows** (`client.workflow.*`)\n- **`client.workflow.trigger()`** - Triggers a workflow with given data and notification payloads\n- **`client.workflow.trigger_bulk()`** - Triggers a workflow in bulk for multiple recipients\n- **`client.workflow.schedule()`** - Schedules a workflow to run at a future time (once or recurring)\n\n**Webhooks** (`client.webhook.*`)\n- **`client.webhook.configure_notifications()`** - Configures webhook URL for receiving status updates\n- **`client.webhook.configure_inbound()`** - Configures webhook URL for receiving inbound messages\n\n**Users** (`client.user.*`)\n- **`client.user.add()`** - Creates a new user or updates existing user with given unique_id\n- **`client.user.update()`** - Updates an existing user's information\n- **`client.user.delete()`** - Deletes an existing user\n\n## Examples\n\nFor detailed usage examples of all SDK methods, see the [examples](./examples/) folder.\n\n## For Package Developers\n\n### Environment Configuration\n\nFor testing the SDK, set these environment variables:\n\n- **`SIREN_API_KEY`**: Your API key from the Siren dashboard\n- **`SIREN_ENV`**: Set to `dev` for development/testing (defaults to `prod`)\n\n### Prerequisites\n\n*   Git\n*   Python 3.8 or higher\n*   `uv` (installed, see [uv installation guide](https://github.com/astral-sh/uv#installation))\n\n### Setup Steps\n\n1.  **Clone the repository:**\n    ```bash\n    git clone https://github.com/KeyValueSoftwareSystems/siren-py-sdk.git\n    cd siren-py-sdk\n    ```\n\n2.  **Create a virtual environment using `uv`:**\n    This creates an isolated environment in a `.venv` directory.\n    ```bash\n    uv venv\n    ```\n\n3.  **Activate the virtual environment:**\n    Commands will now use this environment's Python and packages.\n    ```bash\n    source .venv/bin/activate\n    ```\n    *(On Windows, use: `.venv\\Scripts\\activate`)*\n\n4.  **Install dependencies with `uv`:**\n     This installs `trysiren` in editable mode (`-e`) and all development dependencies (`.[dev]`).\n     ```bash\n     uv pip install -e \".[dev]\"\n     ```\n\n5.  **Set up pre-commit hooks:**\n     (Ensures code quality before commits)\n     ```bash\n     uv run pre-commit install\n     ```\n\n     You are now ready to contribute to the `trysiren` SDK!\n\n     Try `$ python examples/messaging_async.py`\n\n### Code Style \u0026 Linting\n\n*   Code style is enforced by `ruff` (linting, formatting, import sorting) and `pyright` (type checking).\n*   These tools are automatically run via pre-commit hooks.\n\n### Running Tests\n\nTo run the test suite, use the following command from the project root directory:\n\n```bash\nuv run pytest\n```\n\nThis will execute all tests defined in the `tests/` directory.\n\n### Submitting Changes\n\n*   Create a feature branch for your changes.\n*   Commit your changes (pre-commit hooks will run).\n*   Push your branch and open a Pull Request against the `develop` repository branch.\n\n\n## Changes planned\n- Check how critical is .close() for async client, explore ways to avoid that.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkeyvaluesoftwaresystems%2Fsiren-py-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkeyvaluesoftwaresystems%2Fsiren-py-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkeyvaluesoftwaresystems%2Fsiren-py-sdk/lists"}