Run a slash command
const url = 'http://localhost:11044/api/v1/chat/command/example';const options = { method: 'POST', headers: {'X-Embabel-Api-Key': '<X-Embabel-Api-Key>', 'Content-Type': 'application/json'}, body: '{"argument":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url http://localhost:11044/api/v1/chat/command/example \ --header 'Content-Type: application/json' \ --header 'X-Embabel-Api-Key: <X-Embabel-Api-Key>' \ --data '{ "argument": "example" }'Executes a world slash command by sending it as a chat message. The response is delivered via the SSE stream. An SSE stream must be open before running commands.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Name of one of the world’s slash commands, without the leading slash, matched case-insensitively; 404 when the world has no command by that name
Request Body
Section titled “Request Body”Optional. argument is the text that follows the command, which is sent as the chat message /<command> <argument>; a body left out, or an argument that is null or blank, runs the bare /<command>. Its output arrives on the SSE stream, which must already be open or the request is refused with 409
Optional body of POST /chat/command/{command}: the text that follows the slash command
object
Text appended after /
Example generated
{ "argument": "example"}Responses
Section titled “Responses”Command accepted
object
Unknown command
A refusal from the chat surface: the word error and the reason, written to be shown
object
What was refused and why, such as no open stream, no active session, or an unknown command
Always error. A client may branch on it rather than on the status code
Example
errorNo active SSE stream — open /stream first
A refusal from the chat surface: the word error and the reason, written to be shown
object
What was refused and why, such as no open stream, no active session, or an unknown command
Always error. A client may branch on it rather than on the status code
Example
error
