# ![«Image: Quadratic»](images/quadratic-logo.png "Quadratic") Quadratic A Jami bot account can be created for a dedicated bot identity to run a [Quadratic](https://www.quadratichq.com/) spreadsheet. You will still need to write a custom script to act as the bridge between Jami and Quadratic. While Jami provides the automated P2P bot profile and an API Token, it does not feature an off-the-shelf "Quadratic plugin". A self-hosted Quadratic instance operates on web technologies (REST APIs and WebSockets), your custom script must bridges these two separate worlds. ```{raw} html
``` ## Integrating Self-Hosted Quadratic via Jami Bot Accounts While GNU Jami does not natively host web applications, you can leverage a Jami Bot Account to act as a secure, decentralized management hub for an external self-hosted Quadratic spreadsheet instance. This architecture allows teams to safely ingest data, issue commands, and distribute live collaboration session tokens entirely through a private peer-to-peer network. ```{note} Quadratic requires real-time canvas streaming (WebGL/WebSockets), actual multi-user editing must happen in a web browser. The Jami bot serves as the command-and-control broker rather than the graphical canvas itself. ``` ## Prerequisites * A desktop instance of Jami (Linux, macOS, or Windows) running the target account. * An active, self-hosted Quadratic instance deployed via Docker. * A custom middleware bridge script (written in Python or Node.js) to route requests between APIs. ## Step 1: Provision the Bot in Jami 1. Launch Jami on your desktop environment. 2. Navigate to **Settings** → **App Access**. 3. Click **Create Bot** to trigger the automated creation wizard. 4. Input a recognizable name (e.g., `Quadratic Assistant`). 5. Securely copy the generated **API Token** and the bot's unique **JamiID**. ```{important} The API Token is displayed only once. Anyone with access to this token can spoof commands to your spreadsheet infrastructure. Never share it. ``` ## Step 2: Deploy the Middleware Bridge Script Your custom script must listen continuously to the Jami network using the API token and translate message events into instructions for your self-hosted Quadratic REST/WebSocket backend. An optimal production implementation should include an Access Control List (ACL) to verify user identities before modifying spreadsheet files. ### Example Conceptual Implementation (Python) ```python import requests # Configuration JAMI_TOKEN = "your_copied_api_token" QUADRATIC_API_URL = "http://localhost:5000/api" ALLOWED_USERS = ["jami_id_alpha", "jami_id_beta"] def handle_incoming_message(sender_id, text): # 1. Enforce strict authorization if sender_id not in ALLOWED_USERS: return "Access Denied: Your JamiID is unauthorized." # 2. Command Parsing: Fetch Live Session Link if text.strip() == "/get_session": try: response = requests.post(f"{QUADRATIC_API_URL}/sheets/project_alpha/share") share_link = response.json().get("url") return f"Join the live collaborative session: {share_link}" except Exception: return "Failed to communicate with the Quadratic server." # 3. Command Parsing: Append Data Payload elif text.startswith("/log "): payload = text.replace("/log ", "").strip() # Custom logic to format data and execute an API patch to Quadratic # ... return f"Successfully logged data point: '{payload}'" return "Unknown command. Use /get_session or /log [data]." ``` ## Step 3: Share the Workspace Hub 1. Distribute the bot's **JamiID** to your permitted team members. 2. Users can search for the ID within their respective Jami clients and submit a contact request. 3. The Jami network automatically accepts incoming contact requests to bot profiles within seconds. 4. Authorized users can now type commands directly into the chat to fetch metrics or fetch live browser-based editing URLs generated on the fly.