Event shortcuts

Rivet provides built-in shortcuts that enable you to execute complex processes in just a few lines of code.

This section describes the shortcuts available in the Zoom Chat and Chatbot Rivet modules. Refer to the reference documentation for the remaining modules until shortcuts are available for them.

Chatbot

onSlashCommand()

Your app can use the onSlashCommand() method to listen to incoming slash command requests.

Use the say() method to respond to slash commands. It accepts a string or App Card JSON.

chatbotClient.webEventConsumer.onSlashCommand(
    "SLASH_COMMAND",
    async ({ say, payload }) => {
        console.log(payload);
        await say("Hello World!");
    },
);

onButtonClick()

Your app can listen to button clicks and respond using the onButtonClick() method. This method takes in a string, which filters button action values.

You can respond with the say() function, which accepts a string or App Card JSON.

chatbotClient.webEventConsumer.onButtonClick(
    "BUTTON_VALUE",
    async ({ say, payload }) => {
        console.log(payload);
        await say("Hello World!");
    },
);

Zoom Chat

onChannelMessagePosted()

You can use the onChannelMessagePosted() method to listen to messages that your app can receive.

You can use the reply() method to respond to slash commands. It accepts a string or App Card JSON.

teamchatClient.webEventConsumer.onChannelMessagePosted(
    "KEYWORD",
    async ({ reply, payload }) => {
        console.log(payload);
        await reply("Hello World!");
    },
);