Getting your page ready…
JavaScript SDK
Connect Node.js, Express or an existing route.
1. Install the SDK
Requires Node.js 20 or newer, with ESM (type: module in package.json). The package is named wayo-agent. Use the download until registry publication is complete.
Install from your download folder
npm install ./wayo-agent-javascript.tgzAfter publication on pip or npm
Only after the package is published
npm install wayo-agent2. Set your signing secret
In Settings → Developers, copy your signing secret. It is required by the SDK, for Chat, Webhook and REST alike.
Windows · PowerShell
$env:WAYO_SECRET="whsec_REPLACE_WITH_YOUR_REAL_SECRET"macOS, Linux, hosting and .env files
macOS / Linux
export WAYO_SECRET="whsec_REPLACE_WITH_YOUR_REAL_SECRET"On your hosting service, add WAYO_SECRET in environment settings. A .env file must be loaded by your application; the SDK does not load it automatically. Start or restart your server after setting the value.
3. Return your first reply
Start with this complete local example. It returns a connection test reply.
standalone.mjs · Node.js server example
import { createServer } from "node:http";
import { Wayo } from "wayo-agent";
const wayo = Wayo.fromEnv();
wayo.onMessage(async message => "Wayo is connected.");
createServer(wayo.nodeHandler()).listen(8080, "127.0.0.1");Run in the terminal where you set WAYO_SECRET
node standalone.mjsReturn plain text or an object containing a nonempty reply. Replace the test reply with your own inventory or business lookup. Register only one handler.
Use the SDK inside an existing route
Next.js · app/api/wayo/route.js
// Initialize wayo and register onMessage in a server-only module.
import { wayo } from "./business-integration.js";
export const POST = wayo.handler();
export const runtime = "nodejs";Pass the original request bytes for signature verification. Do not parse and rebuild the JSON first.
4. Connect in Wayo
Deploy behind a public HTTPS address or expose your local server through an HTTPS tunnel. Localhost cannot be used as a Wayo endpoint.
Example public endpoint · replace with your domain
https://your-business.example/Choose Chat API, enter your final endpoint, and press Test connection. Expect “Wayo is connected.” Then replace the test reply with real data and test again before saving.
Connect Chat APIThe same handler accepts Webhook POST and REST GET. See Requests & replies for their formats. Standalone examples are for development; use your usual production hosting for real traffic.