APIs and events
This section shows you how to access data through Web APIs and manage real-time events through Webhooks. You can use the Web API to interact with the Zoom platform using methods from the module's client endpoints namespace. You can configure your app to respond to events in real time using Zoom's supported Webhooks.
Web API
You can call any of the supported Zoom APIs using their respective methods in the endpoints namespace of the module's client. Here is an example of the sendChatbotMessage API from the Chatbot module.
const reqBody = {
robot_jid: payload.robotJid,
account_id: payload.accountId,
to_jid: payload.toJid,
user_jid: payload.userJid,
content: {
head: {
text: "I am a header",
sub_head: {
text: "I am a sub header",
},
},
body: [
{
type: "message",
text: "I am a message with text",
},
],
},
};
chatbotClient.endpoints.messages
.sendChatbotMessage({ body: reqBody })
.then((response) => {
console.log("SENT MESSAGE", response.data);
});
Listen to events
To listen to events in your app, use the event() method of the eventSubscriptions namespace. You can listen to any supported Zoom Webhook, such as the slash command shown below.
The method receives a required parameter of type string, which filters out webhook events that do not match.
chatbotClient.webEventConsumer.event("bot_notification", (response) => {
const payload = response.payload;
console.log(payload);
});