Call The Telegram Methods
Requirements#
- Use the API module from the error handling section
- To call most of the methods, you first need to run the user authorization
Fundamentals#
To call the Telegram method, use the api.call(method, params, options) method
method#
Method name from methods list. Example for help.getNearestDc:
params#
Let's analyze the example for messages.sendMessage:
- flags โ don't pass it on. Calculated automatically
- peer โ InputPeer type. To pass a constructor of the type use
_ - entities โ Vector of MessageEntity type. To pass a vector, use an array
options#
- dcId โ Number. Default:
2. Call the method on a specific DC - syncAuth โ Boolean. Default:
true. Copy the authorization to all DCs (if the answer contains aauth.authorization)
Example for help.getNearestDc: