A user can simply run the command by typing the command intent, users can also type the intent and additional words.
The additional words and query string are captured and can be accessed in the event.query variable.
For example, your command name is "growth_rate", and a user types "growth_rate July, August". In this case, the event.query will have the string "July, August".
Capture user input and context:
event.data.intent: The actual command name being triggered
event.data.user_full_name: The name of user triggering the command
event.data.targetChannel: The chat channel object where the command was run
Utilize request for API interactions. The request variable is a wrapper of the JS superagent library:
Your command can respond with a string:
Or your command can return with a JSON special object that provides text responses and interactive buttons:
When you utilize the JSON response with interactive buttons, the "value" can be a reference to the same command intent with different query parameters. This way you can build more complex flows using one single code command.
We provide a simple SDK that you can use to interact with the DailyBot platform.
You can store JSON {} objects in item keys that are associated with the user making the request/interacting with the chat command.
Users can book a meeting room by typing book_room [room_name] [date] [time]:
Users can get the latest tech news by typing tech_news: