I am trying simply connect to Telegram API servers and get response. I've create a app in my.telegram.org, Now I have my api_id, api_hash and also IP address to Telegram api MTproto serever. for getting start documentation says we have to Authorize first using auth.sendCode method to send a code to api user's phone.
so I tried this python script to use auth.sendCode method:
q="auth.sendCode \"phone_number\" 0 api_id \"api_hash\" \"en\""
res = requests.post("http://149.154.167.50:443",data=q)
and when I print res, it says Response [404]. according to the documentation it means An attempt to invoke a non-existent object, such as a method.
I am sure the problem is about my data field in post request. the string I made for calling auth.sendCode method is wrong so server can't recognize what I am trying to reach to.
there is a Query example for that method in documentation :
(auth.sendCode "79991234567" 1 32 "test-hash" "en")
please someone helps me to correct that data string (according to this example). how can I implement API methods in Post Requests?
First steps: Understand how to generate a Telegram AuthKey.
That exercise will help you build up the the basic knowledge need to move tackle Telegram API (and the rest API documentation) on your own.
For starters, i have outlined some of the basics in this SO Post (using vb.net)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With