Beta
All guides

Node.js / Next.js / Express

One module without packages, with a ready Next.js route.

Download virtual-employee-node.zip

Next.js (App Router)

  1. Put virtual-employee.mjs, example-store.mjs and next-route.ts (renamed to route.ts) in app/api/ve/[...path]/.
  2. Set VIRTUAL_EMPLOYEE_SECRET to a long random key. If a middleware redirects by language, exclude /api.

Express

import { createVirtualEmployeeHandler, toNodeMiddleware } from "./virtual-employee.mjs";
import { store } from "./example-store.mjs";

// before any body parser
app.use(toNodeMiddleware(createVirtualEmployeeHandler({ secret: process.env.VIRTUAL_EMPLOYEE_SECRET, store })));

In your panel

  1. In your panel, open the employee that writes (articles or news) and go to the website settings.
  2. Enter your website address (https, the root of the domain) and the same website key as on your site. Press “Make a key for me” if you have none yet.
  3. Save and press “Write one now” to test. Keep publishing without asking off until you have seen a draft arrive.

Good to know

The example store writes files: on hosting without a writable disk (serverless) use your database.