I'm trying to send a text for example "Hello # World" with Telegram API with this url:
https://api.telegram.org/bot'token'/sendMessage?chat_id='chatid'&text=Hello+#+World
But I just receive Hello
I also tried to encode it like this:
https://api.telegram.org/bot'token'/sendMessage?chat_id='chatid'&text=Hello+%23+World
But I just receive Hello %23 World.
Any solution to receive Hello # World? Thanks :D
You did not url-encode the string properly, it should be
Hello%20%23%20World
Instead off
Hello+%23+World
The complete url:
https://api.telegram.org/bot<TOKEN>/sendMessage?chat_id=<CHAT-ID>&text=Hello%20%23%20World
Related
hello friends I want to send a Text message with emojis but I can't able to send when I add emoji to a text msg it stops working
I want to send a message like this -
Hello friends 😀 how are you
and this is the code I use. if anyone knows how to send emojis and text at the same time plz help
print("Sending Message to:", user['name'])
client.send_message(receiver, message)
print("Waiting {} seconds".format(SLEEP_TIME))
time.sleep(SLEEP_TIME)
I need to send an URL that contains thespecial character # through Telegram API post request.
I'm currently use HTML as parse mode.
The message to send is something like:
<a href='www.example.com/#/otherparams'>inline link example</a>
But when I send message the substring of the URL from the # to the end is automatically deleted.
I try to encode the # with related ASCII code %23 and the message is sent correctly, but the when I click on the link the URL doesn't works. I think there isn't a resolution of %23. If I manually replace the ASCII code in the URL bar of the browser with # works.
I obviously try to escape the char # with backslash, but the problem still persists.
On the docs I can't find nothing.
This is an example of script that I'm using, written in Python.
The problem is only #, if I change the message with an URL that doesn't contain #, the script works.
import requests
msg="<a href='www.example.com/#/otherparams'>inline link example</a>"
requests.post("https://api.telegram.org/bot" + token + "/sendMessage" + "?chat_id=" + chat_id + "&parseMode=html&text=" + msg)
Right now i am developing a chat bot using Dialogflow(API.AI) and the problem is when i send a message that contains a apostrophe(') the bot shows it as &apos , is there any way to show it as the original character?
for example look the image:
The message name is "Ricardo's Party" but when dialogflow returns the message it says "Ricardo&apost;s Party" there is any way to change that response message?
in the end, the problem was with the characters ' and " i solved the problem sending the message to the webhook(javascript backend) replacing all &apost; and " with "\'" and "\"" and then returning the new message to skype.
iam using QT and Qsslsocket to get some emails body from Gmail using IMAP, I started using the IMAP command to log in, check how many emails I have, and fetch the data from the email I selected I use this commands sure after connected to IMAP using hostname and port.
tag login username password
after login and check the number of messages using tag select inbox I use this command to extract the body of the email.
tag fetch message_number (body[1])
the problem is i got very strange words like this
* 5 FETCH (BODY[1] {1856}
SGkgRmVsaXggYW5kIEZpbmdlcnMgRHVlbGluZyBQaWFub3MsCgpWaWN0b3JpYSBBLiBoYXMg
dXBkYXRlZCB0aGVpciBldmVudC4KClRoZSBwZXJmb3JtYW5jZSBsZW5ndGggaGFzIGJlZW4g
Y2hhbmdlZCB0byAzIGhvdXJzLgoKVGhlIHBlcmZvcm1hbmNlIHN0YXJ0IHRpbWUgaGFzIGJl
ZW4gY2hhbmdlZCB0byA1OjAwcG0uCgoKCgpVc2UgdGhlIGxpbmsgYmVsb3cgdG8gdmlldyB0
aGlzIGxlYWQ6Cmh0dHA6Ly90cmFja2luZy5naWdzYWxhZC5jb20vdHJhY2tpbmcvY2xpY2s/
ZD1RS1FFeEQxZGtIQTZrYWE3YzFXSzcxZ2VDVXBNX0F5UFRkcUpjeUVZcWZwN3RuMklNRXIx
WlRCOVcxYzlfR3VaUEFyaFhJQkIxbWl4S29jSDZXb1dVUTdlUkRsNl8zMTlPSXpLS0NGZmUz
X2FnQmRlN2lPd2hWaFczOXB2V25SMTY0R1JjaWdoYlZVSVpwT2k1NmxnOVhlV2JLcnhEVS05
WGJTWlBnZzhFRU9SMAoKUGVhY2UsIGxvdmUgJiBnaWdzLApUaGUgR2lnU2FsYWQgVGVhbQoK
CkZvbGxvdyBVcyEKRmFjZWJvb2sgaHR0cDovL3RyYWNraW5nLmdpZ3NhbGFkLmNvbS90cmFj
a2luZy9jbGljaz9kPXhkeEJya3I0eFZ0VE95bnhLbzFnUG1FR05HZU1TSlA5ODFSSVpUeEFJ
QlgzVmZuX3BBbk94Y2JMdUdURXpIR1RLWGVEMk9qUjFEc1NPeGRkX1Y4MjFWZXVYY1BEVXZv
TWNleWMwZHVPUXQtMXVDRjNxcHpVNGxDQmViT2VZbUpINVEyClR3aXR0ZXIgaHR0cDovL3Ry
YWNraW5nLmdpZ3NhbGFkLmNvbS90cmFja2luZy9jbGljaz9kPVY3LWpwbEZHVk5QcGExaVdU
VGF2aG5XZWJRLXRDQXZRakN6T2NBRXdCNDZ2R0FtbkplOFBfdHhycXdQUnhBallZbk9DRElt
ZktFeVAxQlNVR1J4MXhWelE4c3gxM2x1eWtoN3pKNXBXa1VKSEtPYThCYlRuUHF6Ykd1VGF0
THVTa3cyCkluc3RhZ3JhbSBodHRwOi8vdHJhY2tpbmcuZ2lnc2FsYWQuY29tL3RyYWNraW5n
L2NsaWNrP2Q9eEMzVEhBbjgyRTZuZ2piQXN6ZHRRVWZQcktNTVAwbDBpbzl0UDgxOW5SazBC
WDdvZmdZLU1OVk1jR2owTXdWQTNhZmV5aUh1T2VBSUE0V0tTM1NLZnU4Wk1nMENJRmszdnR3
X0F4Q1M2aWdiMDdCazBsU0p4QWNQYlJpc19uaFpNdzIKCgpTdG9wIGFsbCBHaWdTYWxhZCBl
bWFpbHMgKG5vdCByZWNvbW1lbmRlZCk6Cmh0dHA6Ly90cmFja2luZy5naWdzYWxhZC5jb20v
dHJhY2tpbmcvdW5zdWJzY3JpYmU/bXNnaWQ9UzQzLVFsVDVBbHhiaUl0SmhxU0NuZzIKCsKp
IFRoZSBHaWcgQnVyZWF1LCBMTEMuIEFsbCByaWdodHMgcmVzZXJ2ZWQuIFBlYWNlLCBsb3Zl
ICYgZ2lnc8KuIGlzIGEgcmVnaXN0ZXJlZCB0cmFkZW1hcmsgb2YgVGhlIEdpZyBCdXJlYXUs
IExMQy4KMjczMyBFLiBCYXR0bGVmaWVsZCBSZCAjMTA1IFNwcmluZ2ZpZWxkLCBNTyA2NTgw
NA==
)
but the email contains normal message have normal words the strange is when i test with another gmail, i take this email from first email and send it forward message to my second email, it give me the normal text in it! so please any help i can't understand what is the problem, also what i tried is using openssl which give me same result as QT strange words, and javaMail library and extract text from first email it worked? so is the problem from the imap command i used or what?
Thanks in advance.
this a screenshot of the email message
Update
when i start some search i checked that this message is encoded to base64 and when i used online decoder it convert to the normal text but the question now is what command should i use so that i can fetch this message body text in normal text automaticly if there is such away.
I have a general question. Should we normally sanitize the SMS text command that the user inputs via their phone for which we send the response? If yes should we sanitize right away i.e. as soon as it comes? Any ideas for the ways that this can be done in asp.net V4.5/MVC?
I am using Twilio. Does Twilio Helper have any APis to do this?
Should we normally sanitize the SMS text command that the user inputs via their phone for which we send the response?
I'm assuming you mean "send to the response", as in Response object in ASP.NET?
Like all input to your application, you should properly encode it when output to the response. You can usually store it in raw, unencoded format in your database, but if this is output to HTML or JavaScript then it should be encoded properly.
e.g. If the " character is output into HTML, then you should encode this as " at the point of output. In MVC, this is automatically done by Razor using the #variable syntax. In classic MVC, the syntax is <%: variable%> (never use <%=variable%> as this will not encode).
If output to JavaScript then it should be hex entity encoded, so " becomes \x22. You can do this in MVC using #Html.Raw(HttpUtility.JavaScriptStringEncode(variable)) (this example is using Razor).
Check out the OWASP XSS Prevention Cheat Sheet for tips on how to encode correctly depending on output context.