Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Telegram Support

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Telegram Support


    Hi,

    I follwed the instructions given at the below thread to send a text message to Telegram from the script.




    I am able to successfully invoke Telegram web link. So that API TokenId and Chat Id are working fine. However when I invoke from an indicator script, I get the below error. Any suggestions on how to make it work?


    11/16/2023 12:10:48 PM System.Net.WebException: The remote server returned an error: (400) Bad Request.
    at System.Net.HttpWebRequest.GetResponse()


    Below the code how I am invoking.

    private void SendTelegramTextMessage(string Msg)
    {

    string url = @"https://api.telegram.org/botAPI TOKENXXXX/sendMessage?chat_id=CHATIDXXX" +Msg;

    try{

    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url) ;
    HttpWebResponse res = (HttpWebResponse)request.GetResponse();


    }catch(Exception e){
    Print(Time[0] + " " +" "+ e.ToString());
    }

    }​

    #2
    Hello greenhollow803,

    What you are seeing is a server error meaning the server you contacted returned that error. Bad request would generally mean in some way the request you made was malformed. To know what the problem is you would need to look at the URL, Parameters and other details of what you made and then check what is required by telegram. You can compare what you made to their API documentation. Based on that observation you can potentially make out what the problem is. External services like telegram are outside of what our support can specifically help with so you may want to also post this error in the thread you had linked for additional help.

    Comment


      #3
      Thank you for a quick response. I missed &text= which caused the issue. Now it worked after fixing the url format

      Comment


        #4
        I ran into the same 400 error when sending messages from an indicator script a while back. Turned out the issue was the missing &text= before the actual message in the URL. Your Msg needs to be URL encoded too, especially if it has spaces or symbols. On our site, we had to tweak a similar script for Telegram updates tied to our SMM panel for promotion with guarantee—it kept failing until we fixed that tiny bit.
        Last edited by Kolumbiann; 04-08-2025, 05:58 AM.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by NullPointStrategies, Today, 05:17 AM
        0 responses
        50 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        126 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        69 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        42 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        46 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X