Sign inSign up

ajeetraina777/sbx-novu-kits:self-hosted

Manifest digest

sha256:2069a52386a31b1afe4d36a699138922f0f2c00893b144dc73c5c2721111fd79

Last pushed

about 1 month by ajeetraina777

Type

Sandbox Kit

Manifest digest

sha256:2069a52386a31b1afe4d36a699138922f0f2c00893b144dc73c5c2721111fd79

yaml
schemaVersion: "2"
kind: mixin
name: novu
version: 1.0.0
displayName: Novu (self-hosted)
description: 'Adds Novu - the open-source notification infrastructure - to any agent: the novu-py SDK wired to a self-hosted Novu API. Defaults to the API on the host at http://host.docker.internal:3000; edit the domain in three places to point at your own deployment. The secret key is proxy-managed and never enters the sandbox.'
sourceURL: https://github.com/ajeetraina/sbx-kits-novu
licenses:
    - Apache-2.0
agentInstructions:
    content: |
        ## Novu - notification infrastructure (self-hosted)

        The official Novu Python SDK (`novu-py`) is installed and wired to a
        **self-hosted** Novu API. `NOVU_API_URL` defaults to
        `http://host.docker.internal:3000` - the API running on the host via
        `docker compose`. If your deployment lives elsewhere, the kit's `spec.yaml`
        must be edited (the API host appears in the allow list, the credential inject
        domain, and `NOVU_API_URL`); it cannot be changed from inside the sandbox.

        The secret key is **proxy-managed**: `NOVU_SECRET_KEY` holds the literal
        `proxy-managed` sentinel, and the sbx proxy swaps in the real key (as
        `Authorization: ApiKey <key>`) on requests to the configured API host. Set the
        key to the same value as `NOVU_SECRET_KEY` on your Novu server, via
        `sbx secret set novu`.

            import os, novu_py
            from novu_py import Novu

            with Novu(
                server_url=os.environ["NOVU_API_URL"],
                secret_key=os.environ["NOVU_SECRET_KEY"],
            ) as novu:
                novu.trigger(trigger_event_request_dto=novu_py.TriggerEventRequestDto(
                    workflow_id="welcome-email",
                    to="subscriber_123",
                    payload={"name": "Ada"},
                ))

        Runnable demos live under `~/runbooks/` - they read `NOVU_API_URL`.
permissions:
    network:
        allow:
            - pypi.org
            - files.pythonhosted.org
            - host.docker.internal
            - host.docker.internal:3000
credentials:
    - service: novu
      description: Novu secret (API) key for your self-hosted instance (NOVU_SECRET_KEY on the server)
      required: true
      apiKey:
        name: NOVU_SECRET_KEY
        proxyManaged: true
        inject:
            - domain: host.docker.internal
              header: Authorization
              format: ApiKey %s
environment:
    variables:
        NO_PROXY: localhost,127.0.0.1
        NOVU_API_URL: http://host.docker.internal:3000
        no_proxy: localhost,127.0.0.1
setup:
    install:
        - command: pip install --break-system-packages 'novu-py==3.19.0' click
          user: "1000"
          description: Install the official Novu Python SDK (novu-py) plus click for the runbooks