Send multiple lines of text to Telegram via WebRequest

 

Dear Developers,

I created an EA in MQL4 where I send 3 lines of text to Telegram where each line is ended with <br> as follows

message = StringFormat("%s v.%s<br>",EXPERT_NAME,EXPERT_VERSION) +   

                  StringFormat("%s:SELL: %.2f lot<br>", Symbol(), LOT_SIZE) +

                  StringFormat("Sell Price: %.8f",Bid);

string url = mBaseUrl+"/bot"+mToken+"/sendMessage?chat_id="+mChatID+"&text="+message;

returnval=WebRequest("GET",url,mCookie,NULL,timeout,mPost,0,mResult,mHeaders);

But somehow, the message are shown in Telegram as 1 single line, concatenating all the 3 lines.

Can anyone provide some help for me on how to separate each lines so it is shown neatly in Telegram message?

Thank you.

Alvin

 

You are missing parse_mode=HTML according to sendMessage syntax in Telegram Bot API, if you want to use HTML tags, but keep in mind, supported tags are little and <br> is not among them.

Simply use "\r\n" instead.

 
Mohammad Hossein Sadeghi #:

You are missing parse_mode=HTML according to sendMessage syntax in Telegram Bot API, if you want to use HTML tags, but keep in mind, supported tags are little and <br> is not among them.

Simply use "\r\n" instead.

I don't know what is the syntax that I have to use, can you help me?
 

Insert %250a to make a line break. (ie replace <br> with %250a)

 
Alfoel Ramirez #: I don't know what is the syntax that I have to use, can you help me?

Syntax is irrelevant. Your DLL is not loaded, per your picture.

 
William Roeder #:

Syntax is irrelevant. Your DLL is not loaded, per your picture.


From the error message it seems that the DLL is 64 bits and MT5 is 32 bits.

 
Philippe Pauleau #:

Insert %250a to make a line break. (ie replace <br> with %250a)

This `%250a` works perfectly to me. Thanks a lot!

 
Philippe Pauleau #:

Insert %250a to make a line break. (ie replace <br> with %250a)

i feel like you saved my life man wow. thx! 
you definetly saved me from another 10 hours of discussions with chatgpt and frustrations. thanks to you, you the king, the big boss!
Reason: