Voltage monitoring with Telegram

Hi everyone.
Voltage monitoring with Telegram notifications has stopped working on all my MikroTiks...

:local volt [/system health get voltage];
	:if ($volt<277) do {
	:log warning ("napryga= " . [:pick [$volt] 0 2] . "." .  [:pick [$volt] 2 3] . "  V")
	:global sendToTele "https://api.telegram.org/bot1xxxxxxxxxxxxxxxxxxxxxxxxxxxxo/sendmessage\?chat_id=-5xxxxxxx6&text=";
	:global volt [/system health get voltage];
	:global simplvolt ($volt / 10);
	:global lowvolt ((($volt - ($simplvolt * 10)) * 10) / 1);
	:global involt ("$[$simplvolt]".",".[:pick "$[$lowvolt]" 0 3] )
	/tool fetch url="$sendToTele $uptime%0ABeliki_Voltage: $involt V "  keep-result=no;
	  
	}

Can anyone suggest how to solve a problem like this? Firmware versions 6.47.10 and 6.49.10.

You now have to URL encode the value you put into the text= parameter of the URL. For example space " " must be replaced with "%20", ":" should also be replaced with "%3A" etc...

image

Also probably whatever you have in $uptime if that also contains special characters it will also need to be URL encoded. Because you are still using RouterOS 6, you'll need to either do that manually, or write a function that does the URL encoding. Some examples from the forum:


Hi everyone!
Thanks to everyone who responded to my question.
I followed CGGXANNX's advice.
I corrected the `tool fetch url` line as shown in the image, and everything started working.

/tool fetch url="$sendToTele%20Zol_Voltage%3A$involt%20V "  keep-result=no;