I think the dot (.) that the error referring to isn’t related to the expression itself, but rather to the value it represents, in your case, “0.751654”
I encountered this issue as well and was able to solve it by changing the Parse Mode to HTML
I cannot escape the dot when it is being added dynamically via the expression. I cannot edit the data that has come from the previous node via expression.
I do not want to add a set node before either as the values are all dynamic and can change.
Thanks, this works in this simple example. My worry is that there are alot of characters that need escaping as per the docs and if my expression contains many of these characters, how can i escape them all?
I could potentially have all of them in an expression coming through and I won’t know about it until the node fails
In all other places characters ‘_’, ‘*’, ‘[’, ‘]’, ‘(’, ‘)’, ‘~’, ‘`’, ‘>’, ‘#’, ‘+’, ‘-’, ‘=’, ‘|’, ‘{’, ‘}’, ‘.’, ‘!’ must be escaped with the preceding character ''.
EDIT: I am also doing some math by adding 2 previous node’s values together and the toString then breaks this. This I could do before hand with a set node, but still something might slip through and stop the node
You can use node code to filter your data source before sending to telegram, this my code to filter from converted markdown default to markdown v2 just throw to AI to fit your flow and of course you can use advance logic to do math or anything you want just make sure you understand the fundamental
function cleanAndFormatText(text) {
text = text.split('\n').filter(line => {
return !/(.*?)(\.png|\.jpg|\.jpeg|\.gif|\.webp)/i.test(line);
}).join('\n');
// Escape dot
text = text.replace(/\./g, '\\.');
// Delete unnecessary char for Telegram Markdown V2
const invalidChars = /([*_\[\]\(\)~`>#\+\-=\|\{\}\.\!])/g;
text = text.replace(invalidChars, '');
// delete all tag HTML
text = text.replace(/<[^>]+>/g, '');
// Change image tag to link 
const imageRegex = /(https?:\/\/[^\s]+?\.(?:png|jpg|jpeg|gif|webp))/gi;
text = text.replace(imageRegex, '!($1)');
return text;
}
// HERE YOUR PREVIOUS PARAMETER MUST MATCH
const inputText = $json.data;
if (!inputText || typeof inputText !== 'string') {
return [];
}
const cleanedText = cleanAndFormatText(inputText);
return [{
json: {
markdownV2: cleanedText,
},
}];