Sign inSign up

ajeetraina777/sbx-novu-kits:latest

Manifest digest

sha256:a92d6dc1766f027ca7f8395879c581f9ac66f13813b8f485d87cd829f27a1ad1

Last pushed

about 1 month by ajeetraina777

Type

Sandbox Kit

Manifest digest

sha256:a92d6dc1766f027ca7f8395879c581f9ac66f13813b8f485d87cd829f27a1ad1

yaml
schemaVersion: "2"
kind: mixin
name: novu
version: 1.0.0
displayName: Novu (Cloud US)
description: 'Adds Novu - the open-source notification infrastructure - to any agent: the novu-py SDK plus a proxy-managed secret key wired to the Novu Cloud US API (api.novu.co). The agent can trigger multi-channel workflows (email, SMS, push, chat, in-app) without the key ever entering the sandbox. Store it once with: sbx secret set novu.'
sourceURL: https://github.com/ajeetraina/sbx-kits-novu
licenses:
    - Apache-2.0
agentInstructions:
    content: |
        ## Novu - notification infrastructure (Cloud US)

        The official Novu Python SDK (`novu-py`) is installed and wired to the Novu
        Cloud **US** API at `https://api.novu.co` (env `NOVU_API_URL`). Novu triggers
        **workflows** that fan out to channels - email, SMS, push, chat, and in-app -
        with per-subscriber routing, digests, and preferences handled server-side.

        The secret key is **proxy-managed**: `NOVU_SECRET_KEY` holds the literal
        `proxy-managed` sentinel inside the sandbox, and the sbx proxy swaps in the
        real key (as `Authorization: ApiKey <key>`) only on requests leaving to
        `api.novu.co`. Pass the sentinel straight through to the SDK - do not try to
        read a real key, there isn't one in here.

            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"],   # the sentinel; proxy swaps it
            ) as novu:
                novu.trigger(trigger_event_request_dto=novu_py.TriggerEventRequestDto(
                    workflow_id="welcome-email",            # a workflow's trigger id
                    to="subscriber_123",                    # a subscriber id (or an object to upsert)
                    payload={"name": "Ada"},                # variables the workflow template uses
                ))

        A workflow with that trigger id must exist in the Novu dashboard first, and
        the `to` subscriber must exist (or be upserted inline). Runnable demos live
        under `~/runbooks/` - `notify.py` (trigger a workflow), `subscribers.py`
        (create/list subscribers), and `healthcheck.py` (verify the key and reach).
permissions:
    network:
        allow:
            - pypi.org
            - files.pythonhosted.org
            - api.novu.co
credentials:
    - service: novu
      description: Novu secret (API) key from Settings -> API Keys in the Novu dashboard
      required: true
      apiKey:
        name: NOVU_SECRET_KEY
        proxyManaged: true
        inject:
            - domain: api.novu.co
              header: Authorization
              format: ApiKey %s
environment:
    variables:
        NO_PROXY: localhost,127.0.0.1,host.docker.internal
        NOVU_API_URL: https://api.novu.co
        no_proxy: localhost,127.0.0.1,host.docker.internal
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