-
Notifications
You must be signed in to change notification settings - Fork 13
Example Slash Command
Author: Duda Nogueira
Objective: Create /example
command with sub command pattern best practices showing how to send a Message or Notification at the same channel the command was run or a Direct Message to the user that has run the command.
Run:
/example message
you should get
also, you can run:
/example notification
as a third option, you can run:
/example direct
Each installed app in Rocket.Chat will get it's own user, like on this example, demo-app.bot. If you don't set the sender of that notification or message, it will default to that user.
Of course, writing /example notification
is not practical, and with time, you will want a shortcuts for that. So we added already some aliases and a help content to make it explicit. It is always a good practice to guide your user on how to use your command. If, for instance, the user try a non existent sub command, for example, /example asdasd
this is what will happen: