@oryksa/sdk
v0.1.3
Published
ORYKSA AI Employees SDK: chat API, knowledge (Brain), webhooks and an in-app chat for web, Node and Electron.
Maintainers
Readme
@oryksa/sdk
Official JavaScript and TypeScript SDK for ORYKSA AI Employees: put an AI employee that already knows the business inside your web app, Node backend or Electron desktop app. Same brain as WhatsApp and the website chat, text and voice.
- Docs: https://developer.oryksa.com
- API:
https://api.oryksa.com/v1
Install
npm install @oryksa/sdkServer (secret key)
import { Oryksa } from "@oryksa/sdk";
const oryksa = new Oryksa(process.env.ORYKSA_API_KEY); // developer.oryksa.com > Keys
const r = await oryksa.chat({ message: "Are you open on Saturday?" });
console.log(r.reply, r.conversation_id);
// Teach the AI employee about your app (e.g. on every release)
await oryksa.learnApp({
name: "FitTrack",
description: "Fitness app to log workouts and follow training plans.",
screens: [{ title: "Workouts", content: "Tap + to log a workout." }],
faq: [{ question: "How do I cancel Premium?", answer: "Settings > Subscription > Cancel." }],
});In the app (session token, never the secret key)
// your server
app.get("/oryksa-token", requireLogin, async (req, res) => {
const s = await oryksa.createSession({ conversationId: "user-" + req.user.id, customerName: req.user.firstName });
res.json({ token: s.client_token });
});
// your web app
import { OryksaClient, mountChat } from "@oryksa/sdk";
const client = new OryksaClient({ getToken: async () => (await fetch("/oryksa-token").then(r => r.json())).token });
mountChat({ client, lang: "en" }); // ready-made chat UIWebhooks
import { verifyWebhook } from "@oryksa/sdk";
app.post("/oryksa-webhook", express.raw({ type: "application/json" }), async (req, res) => {
const event = await verifyWebhook(req.body, req.get("ORYKSA-Signature"), process.env.ORYKSA_WEBHOOK_SECRET);
if (event.type === "booking.created") { /* save it */ }
res.sendStatus(200);
});Errors
Every failed call throws OryksaError with status, code (for example interaction_limit_reached, rate_limited, plan_required) and message.
About the author
Weslley Harakawa - Founder of ORYKSA AI. Based in Lisbon, Portugal. Specialties: artificial intelligence, web and mobile development, blockchain tokenization. Education: University of the People.
- Website: https://harakawa.tech
- LinkedIn: https://www.linkedin.com/in/weslleyharakawa/
- Instagram: https://www.instagram.com/weslley.harakawa
- ORYKSA AI Employees: https://oryksa.com (X: https://x.com/oryksa, Instagram: https://www.instagram.com/oryksaai, YouTube: https://www.youtube.com/@ORYKSAAI)
MIT License · ORYKSA AI Employees · W8 Atlantic Unipessoal Lda
