Use Case Blueprint

Building Autonomous WhatsApp AI Agents.

Turn WhatsApp into an intelligent conversational interface for your product by connecting Wapix Inbound Webhooks to LLM completion pipelines.

System Architecture

1. User MessageInbound WhatsApp text received
2. LLM PipelineWebhook invokes Gemini / GPT-4
3. Wapix RESTPOST /send/message delivers reply

Minimal AI Agent Implementation (Node.js)

import express from "express";
import axios from "axios";

const app = express();
app.use(express.json());

app.post("/whatsapp-webhook", async (req, res) => {
  const { event, data } = req.body;

  if (event === "message" && data?.body) {
    const sender = data.from.replace("@c.us", "");
    const userPrompt = data.body;

    // Call your LLM / AI Model here
    const aiResponseText = await generateAiReply(userPrompt);

    // Send AI reply back via Wapix
    await axios.post("https://api.wapix.sbs/api/v1/send/message", {
      service: "message",
      whatsaap_number: sender,
      text: aiResponseText,
      api_key: process.env.WAPIX_API_KEY
    });
  }

  return res.sendStatus(200);
});

async function generateAiReply(prompt) {
  // Mock LLM answer or OpenAI / Gemini call
  return "Thank you for reaching out! Your support ticket #120 has been logged.";
}
Ready to configure your inbound webhook?Explore Webhook Documentation →