Managing the maximum length of a message
Depending on the restrictions of each OSNS, there is a limit to a length a message can be. This can cause trouble for example when displaying a long message history when a user is connecting to a group. Most OSNS will not send the message and return an error code indicating the message is too lengthy.
A possible solution is to store the maximum message length allowed for each OSNS in environnement variables. Before sending a request if postToService.js, we verify if the length of the message is longer than the maximum and split the message into multiple messages.