You can use substring to cut the message up:
for(let i = 0; i < str.length; i += 2000) {
const toSend = str.substring(i, Math.min(str.length, i + 2000));
sendMessage(toSend);
}
2
solved Sending 2 different messages if message exceeds 2000 characters