---
title: MadelineProto documentation
description: PHP client/server for the telegram MTProto protocol (a better tg-cli)
image: https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png
---
# MadelineProto, a PHP MTProto telegram client
Created by Daniil Gentili
Do join the official channel, [@MadelineProto](https://t.me/MadelineProto) and the [support groups](https://t.me/pwrtelegramgroup)!
Approved by Telegram!
## What's this?
This library can be used to easily interact with Telegram **without** the bot API, just like the official apps.
It can login with a phone number (MTProto API), or with a bot token (MTProto API, **no bot API involved!**).
[It is now fully async](https://docs.madelineproto.xyz/docs/ASYNC.html)!
## Getting started ([now fully async!](https://docs.madelineproto.xyz/docs/ASYNC.html))
```php
async(true);
$MadelineProto->loop(function () use ($MadelineProto) {
yield $MadelineProto->start();
$me = yield $MadelineProto->get_self();
$MadelineProto->logger($me);
if (!$me['bot']) {
yield $MadelineProto->messages->sendMessage(['peer' => '@danogentili', 'message' => "Hi!\nThanks for creating MadelineProto! <3"]);
yield $MadelineProto->channels->joinChannel(['channel' => '@MadelineProto']);
try {
yield $MadelineProto->messages->importChatInvite(['hash' => 'https://t.me/joinchat/Bgrajz6K-aJKu0IpGsLpBg']);
} catch (\danog\MadelineProto\RPCErrorException $e) {
$MadelineProto->logger($e);
}
yield $MadelineProto->messages->sendMessage(['peer' => 'https://t.me/joinchat/Bgrajz6K-aJKu0IpGsLpBg', 'message' => 'Testing MadelineProto!']);
}
yield $MadelineProto->echo('OK, done!');
});
```
[Try this code now!](https://try.madelineproto.xyz) or run this code in a browser or in a console.
Tip: if you receive an error (or nothing), [send us](https://t.me/pwrtelegramgroup) the error message and the `MadelineProto.log` file that was created in the same directory (if running from a browser).
## Documentation
* [Async](https://docs.madelineproto.xyz/docs/ASYNC.html)
* [Usage](https://docs.madelineproto.xyz/docs/ASYNC.html#usage)
* [Loading the latest version of MadelineProto](https://docs.madelineproto.xyz/docs/ASYNC.html#loading-the-latest-version-of-madelineproto)
* [Enabling the MadelineProto async API](https://docs.madelineproto.xyz/docs/ASYNC.html#enabling-the-madelineproto-async-api)
* [Using the MadelineProto async API](https://docs.madelineproto.xyz/docs/ASYNC.html#using-the-madelineproto-async-api)
* [Async in event handler](https://docs.madelineproto.xyz/docs/ASYNC.html#async-in-event-handler)
* [Async in callback handler](https://docs.madelineproto.xyz/docs/ASYNC.html#async-in-callback-handler)
* [Wrapped async](https://docs.madelineproto.xyz/docs/ASYNC.html#wrapped-async)
* [Multiple async](https://docs.madelineproto.xyz/docs/ASYNC.html#multiple-async)
* [ArrayAccess async](https://docs.madelineproto.xyz/docs/ASYNC.html#arrayaccess-async)
* [Ignored async](https://docs.madelineproto.xyz/docs/ASYNC.html#ignored-async)
* [Blocking async](https://docs.madelineproto.xyz/docs/ASYNC.html#blocking-async)
* [MadelineProto and AMPHP async APIs](https://docs.madelineproto.xyz/docs/ASYNC.html#madelineproto-and-amphp-async-apis)
* [Helper methods](https://docs.madelineproto.xyz/docs/ASYNC.html#helper-methods)
* [Async sleep](https://docs.madelineproto.xyz/docs/ASYNC.html#async-sleep-does-not-block-the-main-thread)
* [Async readline](https://docs.madelineproto.xyz/docs/ASYNC.html#async-readline-does-not-block-the-main-thread)
* [Async echo](https://docs.madelineproto.xyz/docs/ASYNC.html#async-echo-does-not-block-the-main-thread)
* [MadelineProto artax HTTP client](https://docs.madelineproto.xyz/docs/ASYNC.html#madelineproto-artax-http-client)
* [Async forking](https://docs.madelineproto.xyz/docs/ASYNC.html#async-forking-does-green-thread-forking)
* [Combining async operations](https://docs.madelineproto.xyz/docs/ASYNC.html#combining-async-operations)
* [MadelineProto async loop APIs](https://docs.madelineproto.xyz/docs/ASYNC.html#async-loop-apis)
* [Loop](https://docs.madelineproto.xyz/docs/ASYNC.html#loop)
* [ResumableLoop](https://docs.madelineproto.xyz/docs/ASYNC.html#resumableloop)
* [SignalLoop](https://docs.madelineproto.xyz/docs/ASYNC.html#signalloop)
* [ResumableSignalLoop](https://docs.madelineproto.xyz/docs/ASYNC.html#resumablesignalloop)
* [GenericLoop](https://docs.madelineproto.xyz/docs/ASYNC.html#genericloop)
* [Creating a client](https://docs.madelineproto.xyz/docs/CREATING_A_CLIENT.html)
* [Logging in](https://docs.madelineproto.xyz/docs/LOGIN.html)
* [Getting permission to use the telegram API](https://docs.madelineproto.xyz/docs/LOGIN.html#getting-permission-to-use-the-telegram-api)
* [Automatic](https://docs.madelineproto.xyz/docs/LOGIN.html#automatic-now-fully-async)
* [Manual (user)](https://docs.madelineproto.xyz/docs/LOGIN.html#manual-user)
* [API ID](https://docs.madelineproto.xyz/docs/LOGIN.html#api-id)
* [Manual (bot)](https://docs.madelineproto.xyz/docs/LOGIN.html#manual-bot)
* [Logout](https://docs.madelineproto.xyz/docs/LOGIN.html#logout)
* [Changing 2FA password](https://docs.madelineproto.xyz/docs/LOGIN.html#changing-2fa-password)
* [Features](https://docs.madelineproto.xyz/docs/FEATURES.html)
* [Requirements](https://docs.madelineproto.xyz/docs/REQUIREMENTS.html)
* [Installation](https://docs.madelineproto.xyz/docs/INSTALLATION.html)
* [Simple](https://docs.madelineproto.xyz/docs/INSTALLATION.html#simple)
* [Simple (manual)](https://docs.madelineproto.xyz/docs/INSTALLATION.html#simple-manual)
* [Composer from scratch](https://docs.madelineproto.xyz/docs/INSTALLATION.html#composer-from-scratch)
* [Composer from existing project](https://docs.madelineproto.xyz/docs/INSTALLATION.html#composer-from-existing-project)
* [Handling updates (new messages)](https://docs.madelineproto.xyz/docs/UPDATES.html)
* [Self-restart on webhosts](https://docs.madelineproto.xyz/docs/UPDATES.html#self-restart-on-webhosts)
* [Async Event driven](https://docs.madelineproto.xyz/docs/UPDATES.html#async-event-driven)
* [Multi-account: Async Combined Event driven update handling](https://docs.madelineproto.xyz/docs/UPDATES.html#async-combined-event-driven)
* [Async Callback](https://docs.madelineproto.xyz/docs/UPDATES.html#async-callback)
* [Noop (default)](https://docs.madelineproto.xyz/docs/UPDATES.html#noop)
* [Fetch all updates from the beginning](https://docs.madelineproto.xyz/docs/UPDATES.html#fetch-all-updates-from-the-beginning)
* [Settings](https://docs.madelineproto.xyz/docs/SETTINGS.html)
* [Getting info about the current user](https://docs.madelineproto.xyz/docs/SELF.html)
* [Exceptions](https://docs.madelineproto.xyz/docs/EXCEPTIONS.html)
* [List of exception types](https://docs.madelineproto.xyz/docs/EXCEPTIONS.html#list-of-exception-types)
* [Pretty TL trace](https://docs.madelineproto.xyz/docs/EXCEPTIONS.html#pretty-tl-trace)
* [Getting the TL trace](https://docs.madelineproto.xyz/docs/EXCEPTIONS.html#getting-the-tl-trace)
* [Avoiding FLOOD_WAITs](https://docs.madelineproto.xyz/docs/FLOOD_WAIT.html)
* [Logging](https://docs.madelineproto.xyz/docs/LOGGING.html)
* [Telegram VoIP phone calls](https://docs.madelineproto.xyz/docs/CALLS.html)
* [Requesting a call](https://docs.madelineproto.xyz/docs/CALLS.html#requesting-a-call)
* [Playing mp3 files](https://docs.madelineproto.xyz/docs/CALLS.html#playing-mp3-files)
* [Playing streams](https://docs.madelineproto.xyz/docs/CALLS.html#playing-streams)
* [Changing audio quality](https://docs.madelineproto.xyz/docs/CALLS.html#changing-audio-quality)
* [Putting it all together](https://docs.madelineproto.xyz/docs/CALLS.html#putting-it-all-together)
* [Accepting calls](https://docs.madelineproto.xyz/docs/CALLS.html#accepting-calls)
* [Uploading and downloading files](https://docs.madelineproto.xyz/docs/FILES.html)
* [Uploading & sending files](https://docs.madelineproto.xyz/docs/FILES.html#sending-files)
* [Security notice](https://docs.madelineproto.xyz/docs/FILES.html#security-notice)
* [Photos](https://docs.madelineproto.xyz/docs/FILES.html#inputmediauploadedphoto)
* [Documents](https://docs.madelineproto.xyz/docs/FILES.html#inputmediauploadeddocument)
* [Documents](https://docs.madelineproto.xyz/docs/FILES.html#documentattributefilename-to-send-a-document)
* [Photos as documents](https://docs.madelineproto.xyz/docs/FILES.html#documentattributeimagesize-to-send-a-photo-as-document)
* [GIFs](https://docs.madelineproto.xyz/docs/FILES.html#documentattributeanimated-to-send-a-gif)
* [Videos](https://docs.madelineproto.xyz/docs/FILES.html#documentattributevideo-to-send-a-video)
* [Audio & Voice](https://docs.madelineproto.xyz/docs/FILES.html#documentattributeaudio-to-send-an-audio-file)
* [Uploading files](https://docs.madelineproto.xyz/docs/FILES.html#uploading-files)
* [Bot API file IDs](https://docs.madelineproto.xyz/docs/FILES.html#bot-api-file-ids)
* [Reusing uploaded files](https://docs.madelineproto.xyz/docs/FILES.html#reusing-uploaded-files)
* [Downloading files](https://docs.madelineproto.xyz/docs/FILES.html#downloading-files)
* [Extracting download info](https://docs.madelineproto.xyz/docs/FILES.html#extracting-download-info)
* [Download to directory](https://docs.madelineproto.xyz/docs/FILES.html#download-to-directory)
* [Download to file](https://docs.madelineproto.xyz/docs/FILES.html#download-to-file)
* [Download to browser (streaming)](https://docs.madelineproto.xyz/docs/FILES.html#download-to-browser-with-streams)
* [Getting progress](https://docs.madelineproto.xyz/docs/FILES.html#getting-progress)
* [Getting info about chats](https://docs.madelineproto.xyz/docs/CHAT_INFO.html)
* [Full chat info with full list of participants](https://docs.madelineproto.xyz/docs/CHAT_INFO.html#get_pwr_chat-now-fully-async)
* [Full chat info](https://docs.madelineproto.xyz/docs/CHAT_INFO.html#get_full_info-now-fully-async)
* [Reduced chat info (very fast)](https://docs.madelineproto.xyz/docs/CHAT_INFO.html#get_info-now-fully-async)
* [Getting all chats (dialogs)](https://docs.madelineproto.xyz/docs/DIALOGS.html)
* [Dialog list](https://docs.madelineproto.xyz/docs/DIALOGS.html#get_dialogs-now-fully-async)
* [Full dialog info](https://docs.madelineproto.xyz/docs/DIALOGS.html#get_full_dialogs-now-fully-async)
* [Inline buttons ([now fully async!](https://docs.madelineproto.xyz/docs/ASYNC.html))](https://docs.madelineproto.xyz/docs/INLINE_BUTTONS.html)
* [Secret chats](https://docs.madelineproto.xyz/docs/SECRET_CHATS.html)
* [Requesting secret chats](https://docs.madelineproto.xyz/docs/SECRET_CHATS.html#requesting-secret-chats-now-fully-async)
* [Accepting secret chats](https://docs.madelineproto.xyz/docs/SECRET_CHATS.html#accepting-secret-chats-now-fully-async)
* [Checking secret chat status](https://docs.madelineproto.xyz/docs/SECRET_CHATS.html#checking-secret-chat-status-now-fully-async)
* [Sending secret messages](https://docs.madelineproto.xyz/docs/SECRET_CHATS.html#sending-secret-messages-now-fully-async)
* [Lua binding](https://docs.madelineproto.xyz/docs/LUA.html)
* [Using a proxy](https://docs.madelineproto.xyz/docs/PROXY.html)
* [How to set a proxy](https://docs.madelineproto.xyz/docs/PROXY.html#how-to-set-a-proxy)
* [Multiple proxies with automatic switch](https://docs.madelineproto.xyz/docs/PROXY.html#multiple-proxies-with-automatic-switch)
* [Use pre-built MTProxy](https://docs.madelineproto.xyz/docs/PROXY.html#mtproxy)
* [Use pre-built Socks5 proxy](https://docs.madelineproto.xyz/docs/PROXY.html#socks5-proxy)
* [Use pre-built HTTP proxy](https://docs.madelineproto.xyz/docs/PROXY.html#http-proxy)
* [Build your own proxy](https://docs.madelineproto.xyz/docs/PROXY.html#build-your-proxy)
* [Using methods](https://docs.madelineproto.xyz/docs/USING_METHODS.html)
* [FULL API Documentation with descriptions](https://docs.madelineproto.xyz/API_docs/methods/)
* [Logout](https://docs.madelineproto.xyz/logout.html)
* [Login](https://docs.madelineproto.xyz/docs/LOGIN.html)
* [Change 2FA password](https://docs.madelineproto.xyz/update_2fa.html)
* [Get all chats, broadcast a message to all chats](https://docs.madelineproto.xyz/docs/DIALOGS.html)
* [Get the full participant list of a channel/group/supergroup](https://docs.madelineproto.xyz/get_pwr_chat.html)
* [Get full info about a user/chat/supergroup/channel](https://docs.madelineproto.xyz/get_full_info.html)
* [Get info about a user/chat/supergroup/channel](https://docs.madelineproto.xyz/get_info.html)
* [Get info about the currently logged-in user](https://docs.madelineproto.xyz/get_self.html)
* [Upload or download files up to 1.5 GB](https://docs.madelineproto.xyz/docs/FILES.html)
* [Make a phone call and play a song](https://docs.madelineproto.xyz/docs/CALLS.html)
* [Create a secret chat bot](https://docs.madelineproto.xyz/docs/SECRET_CHATS.html)
* Accept telegram passport authorization: account.acceptAuthorization
* Accept telegram's TOS: help.acceptTermsOfService
* Add a sticker set: messages.installStickerSet
* Add a sticker to favorites: messages.faveSticker
* Add a sticker to recent stickers: messages.saveRecentSticker
* Add a user to a normal chat (use channels->inviteToChannel for supergroups): messages.addChatUser
* Add phone number as contact: contacts.importContacts
* Add sticker to stickerset: stickers.addStickerToSet
* Add users to channel/supergroup: channels.inviteToChannel
* Block a user: contacts.block
* Bots only: get telegram passport authorization form: account.getAuthorizationForm
* Bots only: send payment form: payments.sendPaymentForm
* Bots only: set precheckout results: messages.setBotPrecheckoutResults
* Bots only: set shipping results: messages.setBotShippingResults
* Bots only: set the callback answer (after a button was clicked): messages.setBotCallbackAnswer
* Bots only: set the results of an inline query: messages.setInlineBotResults
* Call inline bot: messages.getInlineBotResults
* Cancel password recovery email: account.cancelPasswordEmail
* Change notification settings: account.updateNotifySettings
* Change sticker position in photo: stickers.changeStickerPosition
* Change the phone number associated to this account: account.changePhone
* Change the phone number: account.sendChangePhoneCode
* Change the profile photo: photos.updateProfilePhoto
* Change typing status: messages.setTyping
* Check if about to edit a message or a media caption: messages.getMessageEditData
* Check if an invitation link is valid: messages.checkChatInvite
* Check if this username is available: account.checkUsername
* Check if this username is free and can be assigned to a channel/supergroup: channels.checkUsername
* Clear all drafts: messages.clearAllDrafts
* Clear all recent stickers: messages.clearRecentStickers
* Clear saved payments info: payments.clearSavedInfo
* Confirm password recovery using email: account.confirmPasswordEmail
* Confirm this phone number is associated to this account, obtain phone_code_hash from sendConfirmPhoneCode: account.confirmPhone
* Contact signup notification setting value: account.getContactSignUpNotification
* Convert chat to supergroup: messages.migrateChat
* Create a chat (not supergroup): messages.createChat
* Create channel/supergroup: channels.createChannel
* Create stickerset: stickers.createStickerSet
* Delete a certain session: account.resetAuthorization
* Delete a certain telegram web login authorization: account.resetWebAuthorization
* Delete a channel/supergroup: channels.deleteChannel
* Delete a contact: contacts.deleteContact
* Delete a user from a chat (not supergroup): messages.deleteChatUser
* Delete all logged-in sessions.: auth.resetAuthorizations
* Delete all messages of a user in a channel/supergroup: channels.deleteUserHistory
* Delete all temporary authorization keys except the ones provided: auth.dropTempAuthKeys
* Delete channel/supergroup messages: channels.deleteMessages
* Delete chat history: messages.deleteHistory
* Delete contacts by phones: contacts.deleteByPhones
* Delete messages: messages.deleteMessages
* Delete multiple contacts: contacts.deleteContacts
* Delete profile photos: photos.deletePhotos
* Delete secure telegram passport value: account.deleteSecureValue
* Delete the history of a supergroup/channel: channels.deleteHistory
* Delete this account: account.deleteAccount
* Disable all notifications for a certain period: account.updateDeviceLocked
* Download a file through telegram: upload.getWebFile
* Edit a message: messages.editMessage
* Edit a sent inline message: messages.editInlineBotMessage
* Edit admin permissions of a user in a channel/supergroup: channels.editAdmin
* Edit admin permissions: messages.editChatAdmin
* Edit chat info: messages.editChatAbout
* Edit default rights of chat: messages.editChatDefaultBannedRights
* Edit the photo of a normal chat (not supergroup): messages.editChatPhoto
* Edit the photo of a supergroup/channel: channels.editPhoto
* Edit the title of a normal chat (not supergroup): messages.editChatTitle
* Edit the title of a supergroup/channel: channels.editTitle
* Edit user info: help.editUserInfo
* Enable or disable hidden history for new channel/supergroup users: channels.togglePreHistoryHidden
* Export chat invite : messages.exportChatInvite
* Find a sticker set: messages.searchStickerSets
* Finish account exporting session: account.finishTakeoutSession
* Forward messages: messages.forwardMessages
* Get CDN configuration: help.getCdnConfig
* Get a stickerset: messages.getStickerSet
* Get account TTL: account.getAccountTTL
* Get admin log of a channel/supergroup: channels.getAdminLog
* Get all archived stickers: messages.getArchivedStickers
* Get all channels you left: channels.getLeftChannels
* Get all chats (not supergroups or channels): messages.getAllChats
* Get all contacts: contacts.getContacts
* Get all logged-in authorizations: account.getAuthorizations
* Get all message drafts: messages.getAllDrafts
* Get all secure telegram passport values: account.getAllSecureValues
* Get all stickerpacks: messages.getAllStickers
* Get all supergroups/channels where you're admin: channels.getAdminedPublicChannels
* Get and increase message views: messages.getMessagesViews
* Get app config: help.getAppConfig
* Get autodownload settings: account.getAutoDownloadSettings
* Get available languages: langpack.getLanguages
* Get blocked users: contacts.getBlocked
* Get call configuration: phone.getCallConfig
* Get channel/supergroup messages: channels.getMessages
* Get channel/supergroup participants (you should use `$MadelineProto->get_pwr_chat($id)` instead): channels.getParticipants
* Get chats in common with a user: messages.getCommonChats
* Get contacts by IDs: contacts.getContactIDs
* Get deep link info: help.getDeepLinkInfo
* Get dialog info of peers: messages.getPeerDialogs
* Get dialogs marked as unread manually: messages.getDialogUnreadMarks
* Get document by SHA256 hash: messages.getDocumentByHash
* Get emoji URL: messages.getEmojiURL
* Get emoji keyword difference: messages.getEmojiKeywordsDifference
* Get emoji keywords: messages.getEmojiKeywords
* Get favorite stickers: messages.getFavedStickers
* Get featured stickers: messages.getFeaturedStickers
* Get high scores of a game sent in an inline message: messages.getInlineGameHighScores
* Get high scores of a game: messages.getGameHighScores
* Get info about a certain channel/supergroup participant: channels.getParticipant
* Get info about app updates: help.getAppUpdate
* Get info about chats: messages.getChats
* Get info about multiple channels/supergroups: channels.getChannels
* Get info about users: users.getUsers
* Get info of support user: help.getSupport
* Get information about the current proxy: help.getProxyData
* Get invitation text: help.getInviteText
* Get language pack strings: langpack.getStrings
* Get language pack updates: langpack.getDifference
* Get language pack: langpack.getLangPack
* Get language: langpack.getLanguage
* Get masks: messages.getMaskStickers
* Get message ranges to fetch: messages.getSplitRanges
* Get messages: messages.getMessages
* Get most used chats: contacts.getTopPeers
* Get nearest datacenter: help.getNearestDc
* Get notification exceptions: account.getNotifyExceptions
* Get notification settings: account.getNotifySettings
* Get online status of all users: contacts.getStatuses
* Get online users: messages.getOnlines
* Get passport config: help.getPassportConfig
* Get payment form: payments.getPaymentForm
* Get payment receipt: payments.getPaymentReceipt
* Get pinned dialogs: messages.getPinnedDialogs
* Get poll results: messages.getPollResults
* Get previous messages of a group: messages.getHistory
* Get privacy settings: account.getPrivacy
* Get recent locations: messages.getRecentLocations
* Get recent stickers: messages.getRecentStickers
* Get recent t.me URLs: help.getRecentMeUrls
* Get saved contacts: contacts.getSaved
* Get saved gifs: messages.getSavedGifs
* Get saved payments info: payments.getSavedInfo
* Get secure value for telegram passport: account.getSecureValue
* Get server configuration: help.getConfig
* Get stats URL: messages.getStatsURL
* Get stickers attachable to images: messages.getAttachedStickers
* Get stickers: messages.getStickers
* Get support name: help.getSupportName
* Get telegram web login authorizations: account.getWebAuthorizations
* Get temporary password for buying products through bots: account.getTmpPassword
* Get the callback answer of a bot (after clicking a button): messages.getBotCallbackAnswer
* Get the changelog of this app: help.getAppChangelog
* Get the current password: account.getPassword
* Get the link of a message in a channel: channels.exportMessageLink
* Get the profile photos of a user: photos.getUserPhotos
* Get the settings of apeer: messages.getPeerSettings
* Get unread mentions: messages.getUnreadMentions
* Get updated TOS: help.getTermsOfServiceUpdate
* Get user info: help.getUserInfo
* Get wallpaper info: account.getWallPaper
* Get webpage preview: messages.getWebPage
* Get webpage preview: messages.getWebPagePreview
* Gets list of chats: you should use $MadelineProto->get_dialogs() instead: https://docs.madelineproto.xyz/docs/DIALOGS.html: messages.getDialogs
* Global message search: messages.searchGlobal
* Hide report spam popup: messages.hideReportSpam
* Import chat invite: messages.importChatInvite
* Initializes connection and save information on the user's device and application.: initConnection
* Install wallpaper: account.installWallPaper
* Invalidate sent phone code: auth.cancelCode
* Invoke method from takeout session: invokeWithTakeout
* Invoke this method with layer X: invokeWithLayer
* Invoke with messages range: invokeWithMessagesRange
* Invoke with method without returning updates in the socket: invokeWithoutUpdates
* Invokes a query after successfull completion of one of the previous queries.: invokeAfterMsg
* Join a channel/supergroup: channels.joinChannel
* Kick or ban a user from a channel/supergroup: channels.editBanned
* Leave a channel/supergroup: channels.leaveChannel
* Log data for developer of this app: help.saveAppLog
* Mark channel/supergroup history as read: channels.readHistory
* Mark channel/supergroup messages as read: channels.readMessageContents
* Mark dialog as unread : messages.markDialogUnread
* Mark mentions as read: messages.readMentions
* Mark message as read: messages.readMessageContents
* Mark messages as read in secret chats: messages.readEncryptedHistory
* Mark messages as read: messages.readHistory
* Mark messages as read: messages.receivedMessages
* Mark new featured stickers as read: messages.readFeaturedStickers
* Notify server that you received a call (server will refuse all incoming calls until the current call is over): phone.receivedCall
* Pin or unpin dialog: messages.toggleDialogPin
* Register device for push notifications: account.registerDevice
* Remove a sticker set: messages.uninstallStickerSet
* Remove sticker from stickerset: stickers.removeStickerFromSet
* Reorder pinned dialogs: messages.reorderPinnedDialogs
* Reorder sticker sets: messages.reorderStickerSets
* Report a message in a supergroup/channel for spam: channels.reportSpam
* Report a message: messages.report
* Report a peer for spam: messages.reportSpam
* Report for spam a secret chat: messages.reportEncryptedSpam
* Report for spam: account.reportPeer
* Resend password recovery email: account.resendPasswordEmail
* Resend the SMS verification code: auth.resendCode
* Reset all notification settings: account.resetNotifySettings
* Reset all telegram web login authorizations: account.resetWebAuthorizations
* Reset saved contacts: contacts.resetSaved
* Reset top peer rating for a certain category/peer: contacts.resetTopPeerRating
* Reset wallpapers: account.resetWallPapers
* Result type returned by a current query.: invokeAfterMsgs
* Returns a list of available wallpapers.: account.getWallPapers
* Save a GIF: messages.saveGif
* Save a message draft: messages.saveDraft
* Save autodownload settings: account.saveAutoDownloadSettings
* Save call debugging info: phone.saveCallDebug
* Save telegram passport secure value: account.saveSecureValue
* Save wallpaper: account.saveWallPaper
* Search contacts: contacts.search
* Search gifs: messages.searchGifs
* Search peers or messages: messages.search
* Send a custom request to the bot API: bots.sendCustomRequest
* Send a file to a secret chat: messages.sendEncryptedFile
* Send a media: messages.sendMedia
* Send a message: messages.sendMessage
* Send a service message to a secret chat: messages.sendEncryptedService
* Send an album: messages.sendMultiMedia
* Send an email to recover the 2FA password: auth.requestPasswordRecovery
* Send confirmation phone code: account.sendConfirmPhoneCode
* Send email verification code: account.sendVerifyEmailCode
* Send inline bot result obtained with messages.getInlineBotResults to the chat: messages.sendInlineBotResult
* Send message to secret chat: messages.sendEncrypted
* Send phone verification code: account.sendVerifyPhoneCode
* Send screenshot notification: messages.sendScreenshotNotification
* Send typing notification to secret chat: messages.setEncryptedTyping
* Send vote: messages.sendVote
* Send webhook request via bot API: bots.answerWebhookJSONQuery
* Set account TTL: account.setAccountTTL
* Set contact sign up notification: account.setContactSignUpNotification
* Set phone call rating: phone.setCallRating
* Set privacy settings: account.setPrivacy
* Set secure value error for telegram passport: users.setSecureValueErrors
* Set the game score of an inline message: messages.setInlineGameScore
* Set the game score: messages.setGameScore
* Set the supergroup/channel stickerpack: channels.setStickers
* Set the update status of webhook: help.setBotUpdatesStatus
* Start a bot: messages.startBot
* Start account exporting session: account.initTakeoutSession
* Stop sending PUSH notifications to app: account.unregisterDevice
* Toggle channel signatures: channels.toggleSignatures
* Toggle top peers: contacts.toggleTopPeers
* Unblock a user: contacts.unblock
* Update online status: account.updateStatus
* Update pinned message: messages.updatePinnedMessage
* Update profile info: account.updateProfile
* Update the username of a supergroup/channel: channels.updateUsername
* Update this user's username: account.updateUsername
* Upload a file without sending it to anyone: messages.uploadMedia
* Upload a secret chat file without sending it to anyone: messages.uploadEncryptedFile
* Upload profile photo: photos.uploadProfilePhoto
* Upload wallpaper: account.uploadWallPaper
* Use the code that was emailed to you after running $MadelineProto->auth->requestPasswordRecovery to login to your account: auth.recoverPassword
* Validate requested payment info: payments.validateRequestedInfo
* Verify email address: account.verifyEmail
* Verify phone number: account.verifyPhone
* [Peers](https://docs.madelineproto.xyz/docs/USING_METHODS.html#peers)
* [Files](https://docs.madelineproto.xyz/docs/FILES.html)
* [Secret chats](https://docs.madelineproto.xyz/docs/USING_METHODS.html#secret-chats)
* [Entities (Markdown & HTML)](https://docs.madelineproto.xyz/docs/USING_METHODS.html#entities)
* [reply_markup (keyboards & inline keyboards)](https://docs.madelineproto.xyz/docs/USING_METHODS.html#reply_markup)
* [bot API objects](https://docs.madelineproto.xyz/docs/USING_METHODS.html#bot-api-objects)
* [No result](https://docs.madelineproto.xyz/docs/USING_METHODS.html#no-result)
* [Queues](https://docs.madelineproto.xyz/docs/USING_METHODS.html#queues)
* [Multiple method calls](https://docs.madelineproto.xyz/docs/USING_METHODS.html#multiple-method-calls)
* [Contributing](https://docs.madelineproto.xyz/docs/CONTRIB.html)
* [Translation](https://docs.madelineproto.xyz/docs/CONTRIB.html#translation)
* [Contribution guide](https://docs.madelineproto.xyz/docs/CONTRIB.html#contribution-guide)
* [Credits](https://docs.madelineproto.xyz/docs/CONTRIB.html#credits)
* [Web templates for `$MadelineProto->start()`](https://docs.madelineproto.xyz/docs/TEMPLATES.html)
## Very complex and complete examples
You can find examples for nearly every MadelineProto function in
* [`tests/testing.php`](https://github.com/danog/MadelineProto/blob/master/tests/testing.php) - examples for making/receiving calls, making secret chats, sending secret chat messages, videos, audios, voice recordings, gifs, stickers, photos, sending normal messages, videos, audios, voice recordings, gifs, stickers, photos.
* [`bot.php`](https://github.com/danog/MadelineProto/blob/master/bot.php) - examples for sending normal messages, downloading any media
* [`secret_bot.php`](https://github.com/danog/MadelineProto/blob/master/secret_bot.php) - secret chat bot
* [`multiprocess_bot.php`](https://github.com/danog/MadelineProto/blob/master/multiprocess_bot.php) - multithreaded bot
* [`magna.php`](https://github.com/danog/MadelineProto/blob/master/magna.php) - examples for receiving calls
* [`userbots/pipesbot.php`](https://github.com/danog/MadelineProto/blob/master/userbots/pipesbot.php) - examples for creating inline bots and using other inline bots via a userbot
* [`userbots/MadelineProto_bot.php`](https://github.com/danog/MadelineProto/blob/master/userbots/MadelineProto_bot.php) - Multi-function bot
* [`userbots/pwrtelegram_debug_bot`](https://github.com/danog/MadelineProto/blob/master/userbots/pwrtelegram_debug_bot.php) - Multi-function bot