diff --git a/lib/shared/mention-utils.js b/lib/shared/mention-utils.js
--- a/lib/shared/mention-utils.js
+++ b/lib/shared/mention-utils.js
@@ -52,6 +52,10 @@
 const chatMentionRegexString = `^(?<!\\\\)(@\\[\\[(${idSchemaRegex}):(.{1,${chatNameMaxLength}}?)(?<!\\\\)\\]\\])`;
 const chatMentionRegex: RegExp = new RegExp(chatMentionRegexString);
 
+function encodeChatMentionText(text: string): string {
+  return text.replace(/]/g, '\\]');
+}
+
 function decodeChatMentionText(text: string): string {
   return text.replace(/\\]/g, ']');
 }
@@ -138,5 +142,6 @@
   getTypeaheadRegexMatches,
   getUserMentionsCandidates,
   chatMentionRegex,
+  encodeChatMentionText,
   decodeChatMentionText,
 };