Bots, webhooks and Mnemo
Bots get exactly the access an admin gives them.
Bot accounts
A bot is an account that cannot sign in. It reads and posts through the REST API, receives events over a WebSocket gateway and authenticates with Authorization: Bot <token>. Its messages carry a BOT tag.
- Bots hold roles like members, so a bot only sees the channels you allow.
- Only the Owner and members with Manage bots create bots, and nobody can give a bot more rights than they have. Bots cannot manage roles, bots, webhooks or members.
- A bot can register its own slash commands.
- Bots cannot see direct messages.
The developer docs have the full REST and gateway reference; doc/bot-platform.md explains the design.
Official SDKs
Both SDKs are tested against the server on every change and cover the REST API, the gateway, slash commands, buttons and modals.
- TypeScript for Node.js 24 or newer, MIT-licensed, with no runtime dependencies:
npm install @mnema-xyz/bot-sdk(guide). - Go for Go 1.26 or newer, package
mnema(guide).
go get github.com/mnema-xyz/bot-sdk-go@latest
Example: a slash command bot
A bot that registers /roll and answers with a random number.
TypeScript:
import { Client, OptionType } from '@mnema-xyz/bot-sdk';
const client = new Client({
baseUrl: process.env.MNEMA_URL ?? '',
token: process.env.MNEMA_TOKEN ?? '',
intents: 0,
});
client.on('ready', () =>
client.commands.set([
{
name: 'roll',
description: 'Rolls a die',
options: [{ name: 'sides', description: 'How many sides', type: OptionType.Integer, required: true }],
},
])
);
client.on('interactionCreate', async (i) => {
if (!i.isCommand() || i.commandName !== 'roll') return;
await i.deferReply();
const sides = Number(i.options.get('sides'));
const result = 1 + Math.floor(Math.random() * sides);
await i.editReply(`${i.user.display_name} rolled **${result}** (d${sides})`);
});
await client.connect();
Go:
c, err := mnema.New(mnema.Options{
BaseURL: os.Getenv("MNEMA_URL"),
Token: os.Getenv("MNEMA_TOKEN"),
})
if err != nil {
log.Fatal(err)
}
c.REST.SetCommands(ctx, []mnema.CommandInput{{
Name: "roll", Description: "Rolls dice",
Options: []mnema.CommandOption{{Name: "sides", Description: "Sides of each die", Type: mnema.OptionInteger, Required: true}},
}})
c.OnInteraction(func(ctx context.Context, i *mnema.Interaction) {
if i.CommandName() != "roll" {
return
}
i.DeferReply(ctx, false)
sides := i.Option("sides").Int()
n := rand.Int64N(sides) + 1
text := fmt.Sprintf("%s rolled **%d** (d%d)", i.User.DisplayName, n, sides)
i.EditReply(ctx, mnema.Edit{Content: &text})
})
c.Run(ctx)
Adding someone else's bot
A bot can describe itself in a manifest. Open the bot's add link, or paste the manifest under Admin console > Bots > Add from manifest. You see what the bot asks for and pick its channels; nothing is created until you confirm.
Webhooks
Incoming webhooks accept the common execute format, so most integrations for CI, monitoring or feeds work by pasting the URL. Outgoing webhooks send signed events to your service, with retries and a delivery log. See doc/webhooks.md.
Mnemo
Mnemo is an example bot built on the TypeScript SDK. It answers with an AI model when you mention it or use /ask, and can look up the weather, calculate or search Wikipedia. You run it yourself, with an API key from a provider you choose or with a local model.
It needs Mnema Talk 3.1.0 or newer. Setup takes about five minutes.
Mnema Talk itself has no AI features apart from noise suppression in calls. Mnemo is a separate program, and it only sees the channels you give it.