Trading Software
    Menu Close
    Back to all

    Telegram: SSL/TLS Secure Channel

    If you find that your Telegram API code is no longer sending messages to your bots and you are getting this error then you will need to make sure your code now uses a TLS 1.3 secure connection.


    Telegram SSL/TLS Secure Connection Fix


    What is a TLS Connection?

    Transport Layer Security (TLS) is a protocol that encrypts data sent over the Internet to ensure that hackers are unable to see what you transmit, this is used with Telegram to make sure your messages are encrypted and not intercepted. 


    What Library Are We Using?

    Our example is using Telegram.Bot API library.


    How to Apply a Fix

    Luckily the fix is very simple, all you need to do is include the System.Net library:

    Using System.Net;


    As well as add the following code to your class construction or before you make the telegram call:

    ServicePointManager.Expect100Continue = true;
    ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;


    cTrader cBot Project Setting

    If you are using a cTrader cBot, then you will need to open the project with Visual Studio and then open the project settings window as shown below, from here change your target framework to .NET Framework 4.5.2 as a minimum.


    cTrader cBot NET Version


    Full Example Code

    The code snippet below shows the full example of what you need to do to get it working.

    Telegram TLS/SSL Fix


    Watch a Video Explanation

    The video has been uploaded to 1080p High Quality, so do not forget to set your U-Tube video quality to 1080p HD. 


    cTrader cBots Not Working

    If you have a cTrader cBot that uses Telegram to send messages and you have tried the fix above, but it is still not working, why not contact us to help you.


    How To Test Your Bots?

    You can use the Telegram Testing Tool for the cTrader trading platform to check if you need to apply the fix above, we have updated our tool with the SSL/TLS code.

    Leave your comment Close