MT4 to Telegramm Message \n doesn't work

 

Good evening everyone

I have a short question.
I'd like to send messages from an EA to my telegram.

That works but I can't make a new line in the message. with the \n

Does anyone know what the problem could be?

   message = StringFormat("%s  %s \n Entry: %s",
                          orderType, OrderSymbol(),
                          PriceAsString(OrderOpenPrice())); 
   
   //Send message to telegram
   SendMessageToTelegram("-539614189", message);


Function:

   string base_url="https://api.telegram.org";
   string url=base_url + "/bot" + token + "/sendMessage?chat_id=" + chat_id + "&text=" + UrlEncode(message);      
   
//--- Reset the last error code
   ResetLastError();
   
   int timeout=2000; //--- Timeout below 1000 (1 sec.) is not enough for slow Internet connection
   res=WebRequest("GET",url,cookie,NULL,timeout,post,0,result,headers);


Result:


Does anyone know how I can make a new line?


With best regards
Lukas Roth

Bots: An introduction for developers
  • core.telegram.org
Bots are third-party applications that run inside Telegram. Users can interact with bots by sending them messages, commands…
 
You should include all the code so that the coding expert can see where to fix it.
thank you
 
Comments that do not relate to this topic, have been moved to "Off Topic Posts".
 
You have to set the html flag.
 
Marco vd Heijden:
You have to set the html flag.

How exactly do I do that? Sry I'm really new into Telegram and that.

 
Read the docs.
Telegram Bot API
  • core.telegram.org
The Bot API is an HTTP-based interface created for developers keen on building bots for Telegram. To learn how to create…
 

OKey I figured that I do that with the parse mode right?

I did it like that:

string url=base_url + "/bot" + token + "/sendMessage?chat_id=" + chat_id + "&text=" + message + "&parse_mode=HTML";   

But still doesn't work.

Have I done something wrong?

 

Did you get any error message ?

Do you mean the message is successfully send but not the newline character ?

Maybe you need to insert an escape character first.

Have you tried without formatting the string ?

 string message = " Entry: "+orderType+" \n Symbol: "+OrderSymbol()+" \n OpenPrice: "+DoubleToString(OrderOpenPrice(),2));

     
 

No i don't get any errors.

I have tried it with you code but still get this:


 

You can use %250A for break new line in message was sent.

 
NabiKAZ #:

You can use %250A for break new line in message was sent.

You just saved my life man/girl
Reason: