Eerina

Intelligence

Developer & Merchant Documentation

Getting Started

Quick Start & Deployment

Get your AI agent configured, trained on your product catalogue, and live in under 5 minutes.

1. Account Registration

Register securely at eerina.com/register using your primary business email address. Every new account is provisioned with a complimentary Pilot tier providing 250 AI conversational messages per month, with zero credit card required to start.

2. Knowledge Base & Identity Setup

Navigate to Dashboard > Onboarding. Define your business identity, operating hours, and tone of voice. Upload your product catalogues (CSV, PDF, or manual inventory). The platform automatically indexes your data into a dedicated, isolated vector space with sub-millisecond semantic retrieval.

3. Embed on Your Website

Paste the provided asynchronous embed snippet immediately before the closing </body> tag of your website. Your AI business agent will immediately activate, greet visitors, and handle customer queries.

index.html
<!-- Eerina AI Support Widget -->
<script
  src="https://api.eerina.com/v1/widget.js"
  data-chat-id="YOUR_AGENT_ID"
  defer
></script>
Getting Started

Core Platform Architecture

Deep dive into Eerina’s high-concurrency Edge infrastructure and data isolation guarantees.

High-Concurrency Edge Runtime

Eerina is engineered on a globally distributed Edge network designed to scale effortlessly to millions of concurrent customer sessions. Requests are routed to the nearest regional compute cluster with built-in DDoS mitigation and sub-50ms roundtrip latency.

Zero-Hallucination Retrieval-Augmented Generation (RAG)

Every conversational turn executes strict semantic similarity search across your proprietary business documents. The agent answers strictly using verified facts from your knowledge base. Proprietary business data is encrypted at rest (AES-256) and never used to train public foundational models.

Strict Factual Grounding guarantees your AI agent will never invent fictitious discounts, false return policies, or unauthorized warranties.

Storefront & Commerce

Storefront Widget Integration

Embed the floating chat widget, customize branding tokens, and deploy standalone direct links.

Asynchronous Widget Embed

The Eerina widget bundle is under 15KB gzipped and loads completely asynchronously without blocking DOM rendering or degrading Google Core Web Vitals.

index.html
<script
  src="https://api.eerina.com/v1/widget.js"
  data-chat-id="bot_971aedac..."
  defer
></script>

Theme Customization & Brand Tokens

The widget inherits your curated brand palette automatically. You can customize primary accent colors, position (bottom-right vs. bottom-left), custom launcher icons, and initial greeting directly in Dashboard > Appearance.

Storefront & Commerce

Autonomous Orders & State Machine

Understand the deterministic fulfillment DAG, terminal state invariants, and inventory safety.

Fulfillment State Machine (Forward DAG)

Orders follow a strictly forward-directed state machine: Pending → Confirmed → Paid → Shipped. Once an order advances, its fulfillment status cannot be downgraded to previous states. Cancelled is a strictly terminal state: once cancelled, inventory reservations are permanently voided and fulfillment cannot be modified further.

Terminal state enforcement eliminates ghost deliveries and prevents race conditions under high concurrent traffic.

Cross-Dimensional Coupling Matrix

Fulfillment and payment lifecycles are tightly coupled: (1) Fulfillment "Paid" strictly requires payment status to also be "Paid". (2) Paid orders cannot have fulfillment set to "Pending" or "Confirmed". (3) Refunded orders require fulfillment to be "Cancelled" or "Shipped" (returned). (4) Cash on Delivery (COD) and In-Store Pickup allow "Shipped" with "Unpaid" until cash is collected.

Customer Order Tracking, QR Codes & Real-Time Sync

Customers can track their order status in real time, monitor delivery progress, download receipts, or scan their dynamic black & white QR code anytime via their secure, 128-bit unguessable reference URL (/checkout/[orderUuid]). The short reference (#XXXXXXX) serves as the human-friendly identifier for chat and phone support, while the full canonical UUID guarantees cryptographic endpoint privacy without requiring customer account registration.

Storefront & Commerce

Payment Gateways & Refunds

Configure automated webhooks for Flutterwave and PayPal, and handle offline bank transfers.

Autonomous Webhook Capture

When customers pay via Flutterwave or PayPal Partner Commerce, incoming webhook signatures are verified cryptographically. The database updates the order to Paid and stamps paid_at in real time, triggering instant merchant notifications across Telegram, Push, and Email.

Refund Finality & Audit Immutability

Payment states move: Unpaid → Paid → Refunded. Refunds can only be issued on orders that were previously Paid. Once marked as Refunded, the payment status becomes permanently terminal and cannot be reverted back to Paid or Unpaid, guaranteeing financial non-repudiation.

Automations & Safety

Human Escalation & Live Inbox

Seamlessly transition high-value conversations from AI to your human support team.

Intelligent Escalation Triggers

Escalation triggers automatically when a customer asks to speak to a human representative, when sentiment analysis detects frustration, or when a query falls outside the knowledge base. A priority ticket is generated in your Live Inbox instantly.

Real-Time Agent Takeover

Navigate to Dashboard > Inbox. Clicking on any active ticket allows your human agent to type and respond directly into the chat thread in real-time. The AI gracefully stands down until the human operator resolves and closes the ticket.

Automations & Safety

Guardrails & Threat Defense

Built-in security layers preventing prompt injection, toxic inputs, and data leakage.

Anti-Prompt Injection Engine

Every incoming user message is sanitized and evaluated before reaching the model. Attempts to jailbreak instructions, reveal system prompts, or override commercial rules are blocked deterministically.

Row Level Security & IDOR Prevention

All database queries enforce strict Postgres Row Level Security (RLS) and triple-clause tenant isolation (id + user_id + bot_config_id), guaranteeing zero cross-tenant data leakage.

Automations & Safety

Webhooks & External Dispatch

Stream verified events in real time to Zapier, Make, Telegram, or custom backends.

Signature Verification in Node.js (HMAC-SHA256)

Every webhook carries an X-Eerina-Signature: sha256=<hex> header. Compute the HMAC over the raw request payload using your secret signing key and verify using constant-time comparison.

webhook-server.js
const express = require('express');
const crypto = require('crypto');
const app = express();

const WEBHOOK_SECRET = process.env.EERINA_WEBHOOK_SECRET;

// Raw body is required for accurate HMAC verification
app.use(express.raw({ type: 'application/json' }));

app.post('/webhook', (req, res) => {
  const rawBody = req.body.toString();
  const signature = (req.headers['x-eerina-signature'] || '').replace('sha256=', '');

  const expected = crypto
    .createHmac('sha256', WEBHOOK_SECRET)
    .update(rawBody)
    .digest('hex');

  const isValid = crypto.timingSafeEqual(
    Buffer.from(signature, 'hex'),
    Buffer.from(expected, 'hex')
  );

  if (!isValid) {
    return res.status(403).send('Invalid signature');
  }

  const payload = JSON.parse(rawBody);

  // Verification challenge handshake
  if (payload.event === 'webhook.verify') {
    return res.status(200).send(payload.challenge);
  }

  console.log('Verified Eerina event received:', payload.event);
  res.status(200).send('OK');
});

app.listen(3000, () => console.log('Webhook server running on port 3000'));

Pipe Leads Directly to Telegram

Dispatch verified lead captures and urgent human escalation requests straight to your company Telegram channel.

telegram-bot.js
app.post('/webhook', async (req, res) => {
  // ...verify signature first...
  const payload = JSON.parse(req.body.toString());

  if (payload.event === 'lead_captured') {
    const { name, email, phone } = payload.lead;
    const message = `🔥 New Lead Captured!\nName: ${name}\nEmail: ${email}\nPhone: ${phone || 'N/A'}`;

    await fetch(`https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/sendMessage`, {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({ chat_id: TELEGRAM_CHAT_ID, text: message }),
    });
  }

  res.status(200).send('OK');
});
Developer Reference

REST API Reference

Programmatically query chat sessions, transcripts, customer leads, and order records.

Authentication & Headers

Authenticate all API requests by passing your live secret key in the Authorization header. Manage your API keys in Dashboard > Settings > Developer.

Konsole
Authorization: Bearer ek_live_XXXXXXXXXXXXXXXX

List Active & Archived Sessions

Retrieve a paginated list of all customer conversation sessions. Pass the optional botId query parameter to filter by a specific agent. The response payload explicitly includes bot_id for cross-referencing.

Konsole
curl -X GET "https://app.eerina.com/api/v1/sessions?botId=your_bot_id" \
  -H "Authorization: Bearer ek_live_XXXXXXXXXXXXXXXX"

Export Captured Leads

Retrieve all verified lead contacts, names, emails, and phone numbers. Pass the optional botId query parameter to filter by a specific agent. The response payload explicitly includes bot_id for cross-referencing.

Konsole
curl -X GET "https://app.eerina.com/api/v1/leads?botId=your_bot_id" \
  -H "Authorization: Bearer ek_live_XXXXXXXXXXXXXXXX"

Ready to deploy your custom AI agent?

Get your business assistant trained on your knowledge base and handling customer orders in minutes.