Konvo AI

Build a Konvo plugin

A plugin brings your own systems into Konvo. It can do two things, and most do both:

  • A side panel section: a web page you host that Konvo shows next to every conversation, for the ticket the agent is looking at.
  • An MCP server: tools your server offers to the organization's AI agents, such as looking up an order or starting a return. Konvo connects it when the plugin is installed.

Agencies use plugins to bring an order management system, a returns portal or a loyalty program into the inbox and into the AI agent at once.

You build the page and the server; Konvo never hosts them. You describe them in a small JSON file, the manifest, and the store's admin installs it from the manifest's URL.

This guide gets a working plugin into a Konvo inbox in about 15 minutes.

What you need

  • A page served over https from a public address. For local development, a tunnel such as cloudflared or ngrok gives you one.
  • A Konvo organization where you are an admin (to install the plugin), on a plan that includes the API if your plugin reads Konvo data.

1. Write the manifest

Serve this file from any https URL, for example https://konvo.your-agency.com/plugin.json:

{
  "konvo_plugin": 1,
  "id": "your-oms",
  "name": { "en": "Your OMS" },
  "description": { "en": "Orders and returns from Your OMS" },
  "side_panel": {
    "url": "https://konvo.your-agency.com/panel",
    "title": { "en": "Orders", "es": "Pedidos" },
    "priority": 350,
    "height": 360
  }
}

priority: 350 puts your section between Mentioned products and Shopping. Every field is in the manifest reference.

2. Build the page

Load the SDK and wait for Konvo to hand you the context:

<!doctype html>
<html>
  <body>
    <div id="app">Loading…</div>
    <script src="https://k2.konvoai.com/plugin-sdk/v1.js"></script>
    <script>
      Konvo.autoResize();
      Konvo.init().then(async ({ context, token }) => {
        document.body.dataset.theme = context.theme;
        const res = await fetch("/api/orders", {
          headers: { Authorization: `Bearer ${token}` },
        });
        document.getElementById("app").textContent = await res.text();
      });
      Konvo.onContext((context) => {
        document.body.dataset.theme = context.theme;
      });
    </script>
  </body>
</html>

context is { ticketId, organizationId, language, theme }. The token proves which Konvo user is looking at which ticket: your backend must check it before it answers. The page itself receives no customer data from Konvo.

3. Check the token on your backend

Verify the token against Konvo's public keys, then check that it is for an organization you work with:

import { createRemoteJWKSet, jwtVerify } from "jose";

const keys = createRemoteJWKSet(
  new URL("https://api.k2.konvoai.com/.well-known/jwks.json"),
);
const MY_CUSTOMERS = new Set(["org_01…"]); // their Konvo organization ids

export async function konvoViewer(authorization: string | null) {
  const token = authorization?.replace(/^Bearer /, "") ?? "";
  const { payload } = await jwtVerify(token, keys, {
    issuer: "https://api.k2.konvoai.com",
    audience: "https://konvo.your-agency.com", // your page's origin
  });
  if (!MY_CUSTOMERS.has(String(payload.org_id))) {
    throw new Error("Not one of our organizations");
  }
  return { organizationId: payload.org_id, ticketId: payload.ticket_id };
}

The session token article lists every claim and shows the same check in PHP and Python.

4. Read the ticket from Konvo

Your backend reads the ticket through the Konvo API with an API key created by a member of that organization:

const res = await fetch("https://api.k2.konvoai.com/v1/get_conversation", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.KONVO_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ streamId: viewer.ticketId }),
});
const { conversation, contact } = await res.json();
// contact: { name, identifiers: [{ kind: "email" | "phone" | "instagram", value, verified }] }
// Look the customer up in your system by their email or phone.

Keep the API key on your server. Never send it to the page.

Optional: add an MCP server

If you have an MCP server (Streamable HTTP), name it in the manifest and Konvo connects it when the admin installs your plugin:

"mcp": { "url": "https://mcp.your-agency.com/mcp" }

Konvo checks how the server signs in, the same way it does when an admin adds an MCP server by hand:

  • No sign-in: connected at once, and its tools are listed.
  • OAuth with dynamic client registration: the admin goes to your consent screen right after installing.
  • OAuth that needs an app the merchant registers: the admin finishes in the Add MCP server dialog, which opens with your server already filled in.

The connection takes your plugin's name. The admin then turns its tools on for each AI agent that should use them. Every tool call tells your server the organization and the conversation it is for: see the manifest reference. A plugin can also be only an MCP server: leave out side_panel.

5. Install it

In Konvo, go to Settings → Integrations → Plugin, paste your manifest URL, check what the confirmation shows and install. Open any ticket: your section is in the side panel. If your manifest names an MCP server, it is connected now too, and listed with your plugin.

When you change things

Konvo re-reads your manifest URL every hour and applies what it finds, the page address included. Change the manifest and every organization that installed it follows within the hour, with no approval step. That includes the MCP server: when your manifest names a new one, Konvo connects it for every organization (an OAuth server waits for its admin to authorize it). Whoever controls the manifest URL controls your plugin: read the security checklist before you go live.

The complete sample

Manifest, page and backend in one file. Run it with bun add jose and PUBLIC_URL=… ALLOWED_ORGS=org_01… KONVO_API_KEY=konvo_sk_… bun server.ts, expose port 8787 with a tunnel, and install ${PUBLIC_URL}/plugin.json.

/**
 * A complete Konvo plugin in one file: the manifest, the page, and the
 * backend that checks who is looking and reads the ticket from Konvo.
 *
 *   PUBLIC_URL=https://your-tunnel.example \
 *   ALLOWED_ORGS=org_01… \
 *   KONVO_API_KEY=konvo_sk_… \
 *   bun server.ts
 *
 * Then install `${PUBLIC_URL}/plugin.json` in Konvo (Settings →
 * Integrations → Plugin).
 */
import { createRemoteJWKSet, jwtVerify } from "jose";

const KONVO_APP = "https://k2.konvoai.com";
const KONVO_API = "https://api.k2.konvoai.com";
const PUBLIC_URL = required("PUBLIC_URL").replace(/\/+$/, "");
const ALLOWED_ORGS = new Set(required("ALLOWED_ORGS").split(","));
const API_KEY = required("KONVO_API_KEY");

function required(name: string): string {
	const value = Bun.env[name];
	if (!value) throw new Error(`Set ${name}`);
	return value;
}

const konvoKeys = createRemoteJWKSet(
	new URL(`${KONVO_API}/.well-known/jwks.json`),
);

/** The Konvo user and ticket a request is for, or null when it isn't from Konvo. */
async function viewer(request: Request) {
	const token = request.headers.get("authorization")?.replace(/^Bearer /, "");
	if (!token) return null;
	try {
		const { payload } = await jwtVerify(token, konvoKeys, {
			issuer: KONVO_API,
			audience: new URL(PUBLIC_URL).origin,
			algorithms: ["ES256"],
		});
		// Anyone can install this manifest: answer only our own customers.
		if (!ALLOWED_ORGS.has(String(payload.org_id))) return null;
		return { ticketId: String(payload.ticket_id) };
	} catch {
		return null;
	}
}

const manifest = {
	konvo_plugin: 1,
	id: "sample-plugin",
	name: { en: "Sample plugin" },
	description: { en: "Shows the ticket's customer, as read from Konvo." },
	side_panel: {
		url: `${PUBLIC_URL}/panel`,
		title: { en: "Sample", es: "Ejemplo" },
		priority: 50,
		height: 160,
	},
};

const panel = `<!doctype html>
<html>
<head>
  <meta charset="utf-8">
  <style>
    body { font: 13px system-ui, sans-serif; margin: 0; padding: 4px 0; }
    body[data-theme="dark"] { color: #eee; }
    dt { opacity: .6; } dd { margin: 0 0 8px; }
  </style>
</head>
<body>
  <dl id="out">Loading…</dl>
  <script src="${KONVO_APP}/plugin-sdk/v1.js"></script>
  <script>
    const out = document.getElementById("out");
    const show = (rows) => {
      out.replaceChildren(...rows.flatMap(([k, v]) => {
        const dt = document.createElement("dt"); dt.textContent = k;
        const dd = document.createElement("dd"); dd.textContent = v ?? "—";
        return [dt, dd];
      }));
    };
    Konvo.autoResize();
    Konvo.onContext((c) => { document.body.dataset.theme = c.theme; });
    Konvo.init().then(async ({ context }) => {
      document.body.dataset.theme = context.theme;
      const res = await fetch("/api/ticket", {
        headers: { Authorization: "Bearer " + await Konvo.getToken() },
      });
      if (!res.ok) { out.textContent = "Not available for this organization."; return; }
      const ticket = await res.json();
      show([["Subject", ticket.subject], ["Customer", ticket.customer]]);
    });
  </script>
</body>
</html>`;

Bun.serve({
	port: Number(Bun.env.PORT ?? 8787),
	routes: {
		"/plugin.json": () => Response.json(manifest),
		"/panel": () =>
			new Response(panel, {
				headers: {
					"content-type": "text/html; charset=utf-8",
					// Only the Konvo inbox may frame this page.
					"content-security-policy": `frame-ancestors ${KONVO_APP}`,
				},
			}),
		"/api/ticket": async (request) => {
			const who = await viewer(request);
			if (!who) return new Response("Forbidden", { status: 403 });
			// The API key stays on this server; the page never sees it.
			const res = await fetch(`${KONVO_API}/v1/get_conversation`, {
				method: "POST",
				headers: {
					authorization: `Bearer ${API_KEY}`,
					"content-type": "application/json",
				},
				body: JSON.stringify({ streamId: who.ticketId }),
			});
			if (!res.ok) return new Response("Konvo said no", { status: 502 });
			const { conversation, contact } = await res.json();
			// The customer's emails and phones on file: what you look them up by.
			const customer =
				contact?.identifiers?.find(
					(identifier: { kind: string }) => identifier.kind === "email",
				)?.value ?? contact?.name;
			return Response.json({ subject: conversation?.subject, customer });
		},
	},
});
console.log(`Manifest: ${PUBLIC_URL}/plugin.json`);

Was this article helpful?