When sending messages in a short cycle by Zoom Chat API (POST /chat/users/{userId}/messages), some messages are not posted.
For example, when sending 0 to 1000 messages every 0.1 seconds:
0 to 45: posted
46 to 290: not posted
291 to 304: posted
305 to 829: not posted
830 to 859: posted
860 to 1000: not posted.
The response for all messages is 201 instead of 429 (rate limit), and even for not posted messages, the response body contains the message ID.
However, when requesting the ID of a not posted message to /chat/users/{userId}/messages/{messageId}, the following response is returned: (*** is messageId)
{"code":5401,"message":"Message does not exist: ***."}
My code to send messages is below.
var request = require('request');
let access_token = ***
let channel_id = ***
function send_chat_messages(message){
var options = {
method: "POST",
url: "https://api.zoom.us/v2/chat/users/me/messages",
rejectUnauthorized: false,
headers: {
authorization: "Bearer " + access_token,
"Content-type": "application/json",
},
json: {
message: message,
to_channel: channel_id
}
}
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
}
var i = 0;
var interval_id = setInterval(() => {
if (i == 1000){
clearInterval(interval_id)
}
console.log(i, new Date())
send_chat_messages(i)
i++;
}, 100)