Reply To Telegram message With MQL4

 

hello,

Is there a way for me to search for a specific message in my telegram channel, when SL or TP hited , reply to it using telegram's 'Reply' fonction?

i try this but it didnt work.

20= index msg on telegram manually.

Thanks, have a great day!.

  bool ReplyTelegramMessage(string url,string token,string chat_id,string text)
  {
   string headers="";
   string requestUrl="";
   char postData[];
   char resultData[];
   string resultHeaders="";
   int timeout=1000;
   
    

   requestUrl=StringFormat("%s/bot%s/sendmessage",url,token);
   string params=StringFormat("chat_id=%s&&reply_to_message_id=%s&text=%s",chat_id,20,text);
   
    char data[];
      int data_size=StringLen(params);
      StringToCharArray(params,data,0,data_size);
   ResetLastError();
   int response=WebRequest("POST",requestUrl,NULL,NULL,timeout,data,data_size,resultData,resultHeaders);

   int error_code=GetLastError();
   string error_msg=ErrorDescription(error_code);
   Print("Error in WebRequest. Error code: ",error_code," Error: ",error_msg);

   switch(response)
     {

      case -1:
        {
         int errorCode=GetLastError();
         Print("Error in WebRequest. erroe code= ",errorCode);

         if(errorCode==UrlDefinedError)
           {
            PrintFormat("Add The Adrese '%s' in the list of allowed URLs",url);
           }
         break;
        }
      case 200:
         //Success
         Print("The message has been successfully sent");
         break;

      default:
        {
         string result=CharArrayToString(resultData);
         PrintFormat("Unexpected Response '%i', '%s'",response,result);
         break;
        }
     }

   return(response==200);
  }
Reason: