Skip to content

Slash commands

Slash commands let members invoke a Kit from the message box. Declare them in the manifest and give the Kit bot the commands scope:

"bot": { "displayName": { "en": "Deployer" }, "scopes": ["commands", "messages:write"] },
"commands": [
{
"command": "/deploy",
"url": "https://kit.acme.example/ketvia/commands",
"description": { "en": "Deploy a service" },
"usageHint": { "en": "[service]" }
}
]

Names match ^/[a-z][a-z0-9_-]{1,31}$. Ketvia built-ins are reserved and refused in manifests (/remind, /away, /help, /invite, /leave, /me, /mute, /search, /status, /topic, /shrug, /dm, /msg, /ketvia, /kit, /kits).

Each workspace has a command registry. The first installation gets /deploy; a later installation declaring the same name is registered as /<slug>:deploy. A workspace admin can reassign the plain name to another installation (POST /v1/workspaces/{id}/kit-commands/reassign); the previous holder becomes /<slug>:deploy. Commands are unregistered when the Kit is uninstalled.

Typing /deploy web --fast in a composer does not create a message. The composer suggests commands as you type and calls the Kit. Commands work only in channels the Kit bot is a member of: elsewhere the member sees “Add to this channel to use /deploy”. Ketvia sends a signed request to the command’s URL:

{
"type": "slash_command",
"installationId": "0b4f…",
"workspaceId": "7c1e…",
"command": "/deploy",
"text": "web --fast",
"user": { "id": "a7f0…", "locale": "en" },
"conversationId": "d3a9…",
"responseUrl": "https://api.ketvia.com/api/v1/responses/kres_…",
"triggerId": "trg_…",
"locale": "en",
"toolAccess": { "ticket_count": "channel", "ticket_search": "private" }
}

command is always the name from your manifest, even when it is registered as /<slug>:deploy.

A Kit that declares tools also receives toolAccess: for each of its read tools the member may use in this conversation, "channel" or "private". The rule is exactly the assistant’s tool-grant rule, and it is computed at the moment of the call:

  • "channel": the conversation’s assistant holds an active channel grant of the tool for this conversation. A channel grant belongs to the conversation and is for everyone in it (it is never for one member). An answer that uses the tool may be posted to the channel.
  • "private": the member has their own private grant of the tool (unscoped or for this conversation). The answer is for the member alone: reply ephemerally, never in the channel.
  • A tool that is not listed is not available to this member here. Do not call it for them.

When both exist, "channel" wins. A tool that declares "audience": "private" is never "channel" (a channel run never dispatches it); it is at most "private". Write tools, preview and status tools are never listed. So offer a “post to channel” button only on an answer that is built from tools that are "channel" for this conversation (for example an aggregate report), and post it through the responseUrl; an answer that uses a "private" tool stays ephemeral. The map is empty when the conversation has no assistant, the connection is not active or the Kit is suspended. The field is absent for a Kit that declares no tools. It sits inside the signed body, so it cannot be changed in transit. Ketvia states the access and your Kit applies it; Ketvia cannot stop a Kit from posting with its own bot token, as for any Kit.

Answer 2xx within 3 seconds, optionally with { responseType, text, blocks }. The default is ephemeral: only the member sees it, in their own surface. inChannel posts as the Kit bot and needs messages:write. For slow work, return immediately and answer later through the responseUrl (30 minutes, 5 uses; see Interactivity).

const kit = createKitServer({
signingSecret: process.env.KETVIA_SIGNING_SECRET ?? '',
onCommand: async (command) => {
void startDeploy(command.text).then((url) =>
respond(command.responseUrl, { responseType: 'inChannel', text: `Deployed: ${url}` }),
);
return { text: `Deploying ${command.text}…` };
},
});

A retried composer submission (same clientRequestId) never calls your Kit twice. If your Kit fails or times out, the member sees “ didn’t respond” and can retry. Limit: 10 invocations per minute per member and command.