In order to Send a Chatbot Message, you need to supply the to_jid. The to_jid can be the JID of a Zoom Chat Channel, or Zoom Chat User.
How to get a Channel JID or User JID:
Method 1.
The easiest way to get a Channel JID or User JID is from a Slash Command or UI Element Webhook Event that is sent to your Bot Endpoint URL. When a user sends a slash command, messages your Chatbot directly, or commits an action like pressing a button on a Chatbot, the userJid and toJid will be sent to your Bot Endpoint URL.
The userJid is the user who made the action. The toJid is where the action came from, which can be a Zoom Chat Channel, a 1:1 Zoom Chat Message (essentially the same as a Zoom Chat Channel), or when messaging the Chatbot directly.
(Zoom Chat Channel)
(Zoom Chat 1:1 message)
(Zoom Chat messaging the Chatbot directly)
All of the above scenarios send the following request body (example) to your Bot Endpoint URL:
{
'event': 'bot_notification',
'payload': {
'accountId': '{Account ID}',
'channelName': '{Channel Name}',
'cmd': '{Slash Command}',
'name': '{Name of the Chatbot}',
'robotJid': '{Chatbot JID}',
'timestamp': 1560796234686,
'toJid': '{User or Channel JID of where the Slash Command came from}',
'userId': '{User ID of who sent the Slash Command}',
'userJid': '{User JID of who sent the Slash Command}',
'userName': '{User Name of who sent the Slash Command}'
}
}
Method 2.
Another way you can get a Channel JID or User JID, is with the Get User, Get Users, and or Get Channel APIs.
Note: in order to call the Get User, Get Users, and or Get Channels APIs, you need to use an OAuth Access Token as described here.
- In the Get User response body, you will find the `jid` of the user.
- In the Get Users response body, you will find the `id` of the user, which you can use to create a user_jid by concatenating `id` with '@xmpp.zoom.us'. For example, 'kdykjnimt4kpd8kkdqt9fq@xmpp.zoom.us'.
- In the Get Channels response body you will find the `id` of the channel, which you can use to create a channel_jid by concatenating `id` with '@conference.xmpp.zoom.us'. For example, 'b1c841dc7b0b4as69287e6be05c7f93f25@conference.xmpp.zoom.us'.
Although more complex, this method allows you to retrieve the required properties to send a Chatbot message without first receiving user action. A good use case would be for an automated notification system of some sort.