zoom_api/
chatbot_messages.rs

1use crate::Client;
2use crate::ClientResult;
3
4pub struct ChatbotMessages {
5    pub client: Client,
6}
7
8impl ChatbotMessages {
9    #[doc(hidden)]
10    pub fn new(client: Client) -> Self {
11        ChatbotMessages { client }
12    }
13
14    /**
15     * Send chatbot messages.
16     *
17     * This function performs a `POST` to the `/im/chat/messages` endpoint.
18     *
19     * Send chatbot messages from your marketplace chatbot app.<br><br>
20     * **Scopes:** `imchat:bot`<br>
21     *  **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Medium`<br>
22     * **Authorization Flow**: Client Credentials Flow<br><br>
23     * To get authorized, make a POST request to `/oauth/token` endpoint with grant type as `client_credentials`. <br>Use `https://api.zoom.us/oauth/token?grant_type=client_credentials` as the endpoint for the request.
24     * You will need to send your ClientID and Secret as a Basic base64 encoded AUthorization header. Ex. `Basic base64Encode({client_id}:{client_sceret})`<br><br> Next, use the token recieved (access_token) as a bearer token while making the POST /im/chat/messages request to send chatbot messages.<br><br>
25     * Learn more about how to authorize chatbots in the [Chatbot Authorization](https://marketplace.zoom.us/docs/guides/chatbots/authorization) guide.
26     */
27    pub async fn sendchatbot(
28        &self,
29        body: &crate::types::SendchatbotRequest,
30    ) -> ClientResult<crate::Response<()>> {
31        let url = self.client.url("/im/chat/messages", None);
32        self.client
33            .post(
34                &url,
35                crate::Message {
36                    body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
37                    content_type: Some("application/json".to_string()),
38                },
39            )
40            .await
41    }
42    /**
43     * Edit a chatbot message.
44     *
45     * This function performs a `PUT` to the `/im/chat/messages/{message_id}` endpoint.
46     *
47     * Edit a message that was [sent](https://marketplace.zoom.us/docs/api-reference/zoom-api/im-chat/sendchatbot) by your Chatbot app.<br> After sending a message using the Send Chatbot Message API, you must store the messageId returned in the response so that you can make edits to the associated message using this API.
48     *
49     * **Scope:** `imchat:bot`<br>
50     *  **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Medium`<br>
51     * **Authorization Flow**: Client Credentials Flow<br><br>
52     * To get authorized, make a POST request to `/oauth/token` endpoint with grant type as `client_credentials`. <br>Use `https://api.zoom.us/oauth/token?grant_type=client_credentials` as the endpoint for the request.
53     * You will need to send your ClientID and Secret as a Basic base64 encoded AUthorization header. Ex. `Basic base64Encode({client_id}:{client_sceret})`<br><br> Next, use the token received (access_token) as a bearer token while making the PUT /im/chat/messages/{message_id} request to edit a chatbot message.<br><br>
54     * Learn more about how to authotize chatbots in the [Chatbot Authorization](https://marketplace.zoom.us/docs/guides/chatbots/authorization) guide.
55     *
56     * **Parameters:**
57     *
58     * * `message_id: &str` -- Unique Identifier of the message that needs to be updated. This should be retrieved from the response of [Send Chatbot Message API](https://marketplace.zoom.us/docs/api-reference/zoom-api/im-chat/sendchatbot).
59     */
60    pub async fn edit(
61        &self,
62        message_id: &str,
63        body: &crate::types::EditChatbotMessageRequest,
64    ) -> ClientResult<crate::Response<crate::types::EditChatbotMessageResponse>> {
65        let url = self.client.url(
66            &format!(
67                "/im/chat/messages/{}",
68                crate::progenitor_support::encode_path(message_id),
69            ),
70            None,
71        );
72        self.client
73            .put(
74                &url,
75                crate::Message {
76                    body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
77                    content_type: Some("application/json".to_string()),
78                },
79            )
80            .await
81    }
82    /**
83     * Delete a chatbot message.
84     *
85     * This function performs a `DELETE` to the `/im/chat/messages/{message_id}` endpoint.
86     *
87     * Delete a message that was sent by your chatbot app.<br><br> **Scopes:** `imchat:bot`<br> **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Medium`<br>**Authorization Flow**: Client Credentials Flow<br><br>To get authorized, make a POST request to `/oauth/token` endpoint with grant type as `client_credentials`. <br>Use `https://api.zoom.us/oauth/token?grant_type=client_credentials` as the endpoint for the request.
88     * You will need to send your ClientID and Secret as a Basic base64 encoded AUthorization header. Ex. `Basic base64Encode({client_id}:{client_sceret})`<br><br> Next, use the token received (access_token) as a bearer token while making the DELETE /im/chat/messages/{message_id} request to delete a message.<br><br>
89     * Learn more about how to authotize chatbots in the [Chatbot Authorization](https://marketplace.zoom.us/docs/guides/chatbots/authorization) guide.
90     */
91    pub async fn delete(
92        &self,
93        message_id: &str,
94        body: &crate::types::DeleteChatbotMessageRequest,
95    ) -> ClientResult<crate::Response<crate::types::DeleteChatbotMessageResponse>> {
96        let url = self.client.url(
97            &format!(
98                "/im/chat/messages/{}",
99                crate::progenitor_support::encode_path(message_id),
100            ),
101            None,
102        );
103        self.client
104            .delete(
105                &url,
106                crate::Message {
107                    body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
108                    content_type: Some("application/json".to_string()),
109                },
110            )
111            .await
112    }
113}