Diving in the Internet I found some answers, mainly related with IBus. However, it seems like they are not working with elementary OS 0.4 Loki.
The workaround is simple, just edit the file of the launcher corresponding to Telegram:
and change this line:
Exec=/home/YOUR-USER/Downloads/Telegram/Telegram -- %u
to look like this other one:
Exec=env QT_IM_MODULE=xim /home/YOUR-USER/Downloads/Telegram/Telegram -- %u
That should do the trick. But maybe you need to install a couple of IBus dependencies first? Just in case:
sudo apt install ibus-gtk ibus-gtk3 ibus-qt4