I dealt with a similar issue by using a global variable counter. Every time a message is sent, you can increment the global counter. Once it reach the max number of messages, it won’t send anymore until the timed decrement inject node reduces the variable.
if (maxMsg < 10) {
//send message
maxMsg += 1;
global.set("maxCount",maxMsg);
}
// In a separate function triggered by an inject node every 10 minutes add this code
var maxMsg = global.get("maxCount");
maxMsg -= 1;
if (maxMsg < 0) {
maxMsg = 0;
}
global.set("maxCount",maxMsg);