Bots and Home Automation

Discord, Slack, Telegram, Home Assistant and Node-RED: one HTTP call per message, no special client.

A chat bot and a smart-home automation are both "call an HTTP endpoint and do something with the reply". Because the endpoint is CORS-open and needs no key by default, a bot is a handful of lines.

Discord, Slack and Telegram

typescript
// A Discord bot, a Slack app or any chat integration: it is one HTTP call.
import { Client, GatewayIntentBits } from "discord.js";

const client = new Client({ intents: [GatewayIntentBits.MessageContent, GatewayIntentBits.Guilds] });

client.on("messageCreate", async (msg) => {
  if (msg.author.bot) return;

  const res = await fetch("https://zyraxonai.lovable.app/api/public/zyraxon/v1/chat/completions", {
    method: "POST",
    headers: { "Content-Type": "application/json", Authorization: "Bearer zyraxon" },
    body: JSON.stringify({
      model: "zyraxon-codex",
      messages: [{ role: "user", content: msg.content }],
    }),
  });

  const data = await res.json();
  await msg.reply(data.choices[0].message.content);
});

client.login(process.env.DISCORD_TOKEN);
⚠
Mind the platform's own limits
Chat platforms cap message length. Truncate or split a long reply before posting it, and rate-limit your own sends so you do not get the bot throttled.

Home Assistant and Node-RED

yaml
# Home Assistant, Node-RED and similar automation hosts: use a REST command
# or an HTTP request node. In configuration.yaml:

rest_command:
  zyraxon_ask:
    url: "https://zyraxonai.lovable.app/api/public/zyraxon/v1/chat/completions"
    method: POST
    headers:
      Content-Type: application/json
      Authorization: "Bearer zyraxon"
    payload: >
      {"model": "zyraxon-codex",
       "messages": [{"role": "user", "content": "{{ prompt }}"}]}
ℹ
Turn streaming off here
Automation hosts buffer the whole response, so send "stream": false and read choices[0].message.content.

Where to go next

  • ▸SDKs and Frameworks — the OpenAI SDK, the Vercel AI SDK and LangChain, with full tool-calling loops.
  • ▸Languages and Runtimes — Go, Rust, PHP, Java and .NET with no client package.
  • ▸Automation and HTTP Clients — n8n, Make, Zapier and Postman.