Chat commands are a very quick way to control the flow of the chatbot, useful for testing or to provide some standard features.
Commands are preceded by /
, for example /my-command
. Use a Rules node to redirect the flow of the chatbot based on the command.
Commands also supports parameters, for example with a command like /mycommand 42
it’s possible to access the argument(s) in a Function node
msg.payload.arguments[0]; // -> '42'
In Telegram commands can be defined in @BotFather
and the list is available in the chat keyboard.
In Slack commands are supported at platform level and trigger a http callback. To use RedBot’s commands, just use the double slash, for example //my-command
Some standard commands for chatbot * /start
this command is automatically issued when the user joins the chatbot, it’s a good practice to answer with a welcome message * /privacy
provides some info about the privacy * /terms
provides some info about terms and conditions
Messages that starts with /
are not parsed by nodes like Listen node
and Rivescript node
.
Slack: When the user executes a command in the Slack client a callback is triggered to the Node-RED server. Commands must be defined in the Slack API, as Request URL use the address https://my-node-red-server.com/redbot/slack/command
(an https address is required, in development mode use ngrok https://123466.ngrok.io/redbot/slack/command
)