Problem Statement
Chat SDK can handle incoming slash commands, but it does not provide a unified way to register those commands with platforms. Users must manually register commands in each platform using different flows/APIs, which makes setup confusing and easy to misconfigure. And in some cases, e.g., a Discord slash command doesn't work unless it's registered
Proposed Solution
Add a cross-platform slash command registration API, for example:
const bot = new Chat({
userName: "mybot",
slashCommands: [
{
name: "new",
description: "Create a new account",
options: [
{
name: "username",
description: "username",
type: "string",
required: true,
},
],
},
]
});
Alternatives Considered
No response
Use Case
A bot developer defines /new, /help, and /status once in Chat SDK and registers them across supported platforms without manually calling Discord APIs, Telegram Bot API... and the events work properly, plus adds better UX such as /command auto completion
Priority
Critical
Contribution
Additional Context
This is important because slash commands are platform-level features, not just message text. The current SDK can listen for slash command events, but those events may never arrive unless the command is registered correctly on the target platform.
For example, on Discord, the adapter can handle /new only after /new is registered as an application command. If it is not registered, Discord does not show the command in autocomplete and does not send an INTERACTION_CREATE event. If a user manually types /new, Discord treats it as a normal message, so the adapter receives it through the regular message flow instead of the slash command flow.
Example Discord requires something like this to register a slash command
const res = await fetch(`https://discord.com/api/v10/applications/${appId}/guilds/${guildId}/commands`, {
method: "PUT",
headers: {
Authorization: `Bot ${botToken}`,
"Content-Type": "application/json",
},
body: JSON.stringify([
{
name: "new",
description: "Create new something",
options: [...],
},
]),
});
Then it will appear as
And this is kind of similar for Telegram as well, and maybe Discord, and it will be nice if it's abstracted away
Problem Statement
Chat SDK can handle incoming slash commands, but it does not provide a unified way to register those commands with platforms. Users must manually register commands in each platform using different flows/APIs, which makes setup confusing and easy to misconfigure. And in some cases, e.g., a Discord slash command doesn't work unless it's registered
Proposed Solution
Add a cross-platform slash command registration API, for example:
Alternatives Considered
No response
Use Case
A bot developer defines
/new,/help, and/statusonce in Chat SDK and registers them across supported platforms without manually calling Discord APIs, Telegram Bot API... and the events work properly, plus adds better UX such as /command auto completionPriority
Critical
Contribution
Additional Context
This is important because slash commands are platform-level features, not just message text. The current SDK can listen for slash command events, but those events may never arrive unless the command is registered correctly on the target platform.
For example, on Discord, the adapter can handle /new only after /new is registered as an application command. If it is not registered, Discord does not show the command in autocomplete and does not send an INTERACTION_CREATE event. If a user manually types /new, Discord treats it as a normal message, so the adapter receives it through the regular message flow instead of the slash command flow.
Example Discord requires something like this to register a slash command
Then it will appear as
And this is kind of similar for Telegram as well, and maybe Discord, and it will be nice if it's abstracted away