📙
gramjs
  • Quick Start
  • Introduction
    • Advanced Installation
  • Concepts
    • Authentication
    • Updates (events)
    • Available methods
      • GetMessages
      • Uploading files
      • Downloading files
      • Getting participants of a group/channel
    • Handling Errors
    • Browser
  • FAQ
  • Raw Methods (Generated)
  • Accepting the Terms of Service
    • help.acceptTermsOfService
    • help.getTermsOfServiceUpdate
  • Dealing with spam and ToS violations
    • account.reportPeer
    • channels.reportSpam
    • messages.report
    • messages.reportEncryptedSpam
    • messages.reportSpam
  • Fetching configuration
    • help.dismissSuggestion
    • help.getAppChangelog
    • help.getAppConfig
    • help.getAppUpdate
    • help.getConfig
    • help.getCountriesList
    • help.getInviteText
    • help.getNearestDc
    • help.getSupport
    • help.getSupportName
  • Login via QR code
    • auth.acceptLoginToken
    • auth.exportLoginToken
    • auth.importLoginToken
  • Miscellaneous
    • help.saveAppLog
    • initConnection
    • invokeAfterMsg
    • invokeAfterMsgs
    • invokeWithLayer
    • invokeWithoutUpdates
  • Registration and Authorization
    • auth.bindTempAuthKey
    • auth.cancelCode
    • auth.checkPassword
    • auth.dropTempAuthKeys
    • auth.exportAuthorization
    • auth.importAuthorization
    • auth.importBotAuthorization
    • auth.logOut
    • auth.recoverPassword
    • auth.requestPasswordRecovery
    • auth.resendCode
    • auth.resetAuthorizations
    • auth.sendCode
    • auth.signIn
    • auth.signUp
  • Working with 2FA login
    • account.cancelPasswordEmail
    • account.confirmPasswordEmail
    • account.getPassword
    • account.getPasswordSettings
    • account.resendPasswordEmail
    • account.updatePasswordSettings
  • Working with bot inline queries and callback buttons
    • messages.editInlineBotMessage
    • messages.getBotCallbackAnswer
    • messages.getInlineBotResults
    • messages.sendInlineBotResult
    • messages.setBotCallbackAnswer
    • messages.setInlineBotResults
  • Working with bots (internal bot API use)
    • bots.answerWebhookJSONQuery
    • bots.sendCustomRequest
    • help.setBotUpdatesStatus
  • Working with bots
    • bots.setBotCommands
  • Working with channels and supergroups and geogroups
    • channels.createChannel
    • channels.deleteChannel
    • channels.deleteHistory
    • channels.deleteMessages
    • channels.deleteUserHistory
    • channels.editAdmin
    • channels.editBanned
    • channels.editCreator
    • channels.editLocation
    • channels.editPhoto
    • channels.editTitle
    • channels.exportMessageLink
    • channels.getAdminedPublicChannels
    • channels.getAdminLog
    • channels.getChannels
    • channels.getFullChannel
    • channels.getGroupsForDiscussion
    • channels.getInactiveChannels
    • channels.getMessages
    • channels.getParticipant
    • channels.getParticipants
    • channels.inviteToChannel
    • channels.joinChannel
    • channels.leaveChannel
    • channels.readHistory
    • channels.readMessageContents
    • channels.setDiscussionGroup
    • channels.setStickers
    • channels.togglePreHistoryHidden
    • channels.toggleSignatures
    • channels.toggleSlowMode
    • messages.getStatsURL
  • Working with chats and supergroups and channels
    • messages.addChatUser
    • messages.checkChatInvite
    • messages.createChat
    • messages.deleteChatUser
    • messages.editChatAbout
    • messages.editChatAdmin
    • messages.editChatDefaultBannedRights
    • messages.editChatPhoto
    • messages.editChatTitle
    • messages.exportChatInvite
    • messages.getAllChats
    • messages.getChats
    • messages.getCommonChats
    • messages.getFullChat
    • messages.importChatInvite
    • messages.migrateChat
  • Working with cloud themes
    • account.createTheme
    • account.getTheme
    • account.getThemes
    • account.installTheme
    • account.saveTheme
    • account.updateTheme
    • account.uploadTheme
  • Working with contacts and top peers
    • account.getContactSignUpNotification
    • account.setContactSignUpNotification
    • contacts.acceptContact
    • contacts.addContact
    • contacts.block
    • contacts.deleteByPhones
    • contacts.deleteContacts
    • contacts.getBlocked
    • contacts.getContactIDs
    • contacts.getContacts
    • contacts.getLocated
    • contacts.getSaved
    • contacts.getStatuses
    • contacts.getTopPeers
    • contacts.importContacts
    • contacts.resetSaved
    • contacts.resetTopPeerRating
    • contacts.search
    • contacts.toggleTopPeers
    • contacts.unblock
  • Working with credit cards
    • payments.getBankCardData
  • Working with deep links
    • help.getDeepLinkInfo
    • help.getRecentMeUrls
    • messages.startBot
  • Working with dialogs
    • messages.getDialogs
    • messages.getDialogUnreadMarks
    • messages.getOnlines
    • messages.getPeerDialogs
    • messages.getPeerSettings
    • messages.getPinnedDialogs
    • messages.hidePeerSettingsBar
    • messages.markDialogUnread
    • messages.reorderPinnedDialogs
    • messages.sendScreenshotNotification
    • messages.setTyping
    • messages.toggleDialogPin
  • Working with drafts
    • messages.clearAllDrafts
    • messages.getAllDrafts
    • messages.saveDraft
  • Working with emoji keywords
    • messages.getEmojiKeywords
    • messages.getEmojiKeywordsDifference
    • messages.getEmojiKeywordsLanguages
    • messages.getEmojiURL
  • Working with files
    • help.getCdnConfig
    • messages.getDocumentByHash
    • messages.uploadEncryptedFile
    • messages.uploadMedia
    • upload.getCdnFile
    • upload.getCdnFileHashes
    • upload.getFile
    • upload.getFileHashes
    • upload.getWebfile
    • upload.reuploadCdnFile
    • upload.saveBigFilePart
    • upload.saveFilePart
  • Working with folders
    • folders.deleteFolder
    • folders.editPeerFolders
    • messages.getDialogFilters
    • messages.getSuggestedDialogFilters
    • messages.updateDialogFilter
    • messages.updateDialogFiltersOrder
  • Working with games
    • messages.getGameHighScores
    • messages.getInlineGameHighScores
    • messages.setGameScore
    • messages.setInlineGameScore
  • Working with GDPR export
    • account.finishTakeoutSession
    • account.initTakeoutSession
    • channels.getLeftChannels
    • invokeWithMessagesRange
    • invokeWithTakeout
    • messages.getSplitRanges
  • Working with GIFs (actually MPEG4 GIFs)
    • messages.getSavedGifs
    • messages.saveGif
    • messages.searchGifs
  • Working with instant view pages
    • messages.getWebPage
    • messages.getWebPagePreview
  • Working with localization packs
    • langpack.getDifference
    • langpack.getLangPack
    • langpack.getLanguage
    • langpack.getLanguages
    • langpack.getStrings
  • Working with media autodownload settings
    • account.getAutoDownloadSettings
    • account.saveAutoDownloadSettings
  • Working with message reactions
    • messages.getMessageReactionsList
    • messages.getMessagesReactions
    • messages.sendReaction
  • Working with message threads
    • contacts.blockFromReplies
    • messages.getDiscussionMessage
    • messages.getReplies
    • messages.readDiscussion
  • Working with messages
    • messages.deleteHistory
    • messages.deleteMessages
    • messages.editMessage
    • messages.forwardMessages
    • messages.getHistory
    • messages.getMessageEditData
    • messages.getMessages
    • messages.getMessagesViews
    • messages.getRecentLocations
    • messages.getSearchCounters
    • messages.getUnreadMentions
    • messages.readHistory
    • messages.readMentions
    • messages.readMessageContents
    • messages.receivedMessages
    • messages.search
    • messages.searchGlobal
    • messages.sendMedia
    • messages.sendMessage
    • messages.sendMultiMedia
    • messages.unpinAllMessages
    • messages.updatePinnedMessage
  • Working with notification settings
    • account.getNotifyExceptions
    • account.getNotifySettings
    • account.registerDevice
    • account.resetNotifySettings
    • account.unregisterDevice
    • account.updateDeviceLocked
    • account.updateNotifySettings
  • Working with other users
    • users.getFullUser
    • users.getUsers
  • Working with payments
    • account.getTmpPassword
    • messages.setBotPrecheckoutResults
    • messages.setBotShippingResults
    • payments.clearSavedInfo
    • payments.getPaymentForm
    • payments.getPaymentReceipt
    • payments.getSavedInfo
    • payments.sendPaymentForm
    • payments.validateRequestedInfo
  • Working with polls
    • messages.getPollResults
    • messages.getPollVotes
    • messages.sendVote
  • Working with Public Service Announcement and MTProxy channels
    • help.getPromoData
    • help.hidePromoData
  • Working with scheduled messages
    • messages.deleteScheduledMessages
    • messages.getScheduledHistory
    • messages.getScheduledMessages
    • messages.sendScheduledMessages
  • Working with Seamless Telegram Login
    • account.getWebAuthorizations
    • account.resetWebAuthorization
    • account.resetWebAuthorizations
    • messages.acceptUrlAuth
    • messages.requestUrlAuth
  • Working with secret chats
    • messages.acceptEncryption
    • messages.discardEncryption
    • messages.getDhConfig
    • messages.readEncryptedHistory
    • messages.receivedQueue
    • messages.requestEncryption
    • messages.sendEncrypted
    • messages.sendEncryptedFile
    • messages.sendEncryptedService
    • messages.setEncryptedTyping
  • Working with sensitive content (NSFW)
    • account.getContentSettings
    • account.setContentSettings
  • Working with sponsored proxies
    • help.getProxyData
  • Working with stickers
    • messages.clearRecentStickers
    • messages.faveSticker
    • messages.getAllStickers
    • messages.getArchivedStickers
    • messages.getAttachedStickers
    • messages.getFavedStickers
    • messages.getFeaturedStickers
    • messages.getMaskStickers
    • messages.getOldFeaturedStickers
    • messages.getRecentStickers
    • messages.getStickers
    • messages.getStickerSet
    • messages.installStickerSet
    • messages.readFeaturedStickers
    • messages.reorderStickerSets
    • messages.saveRecentSticker
    • messages.searchStickerSets
    • messages.toggleStickerSets
    • messages.uninstallStickerSet
    • stickers.addStickerToSet
    • stickers.changeStickerPosition
    • stickers.createStickerSet
    • stickers.removeStickerFromSet
    • stickers.setStickerSetThumb
  • Working with telegram passport
    • account.acceptAuthorization
    • account.deleteSecureValue
    • account.getAllSecureValues
    • account.getAuthorizationForm
    • account.getAuthorizations
    • account.getSecureValue
    • account.saveSecureValue
    • account.sendVerifyEmailCode
    • account.sendVerifyPhoneCode
    • account.verifyEmail
    • account.verifyPhone
    • help.getPassportConfig
    • users.setSecureValueErrors
  • Working with the user's account
    • account.changePhone
    • account.confirmPhone
    • account.deleteAccount
    • account.getAccountTTL
    • account.getGlobalPrivacySettings
    • account.getPrivacy
    • account.resetAuthorization
    • account.sendChangePhoneCode
    • account.sendConfirmPhoneCode
    • account.setAccountTTL
    • account.setGlobalPrivacySettings
    • account.setPrivacy
    • account.updateProfile
    • account.updateStatus
  • Working with TSF (internal use only)
    • help.editUserInfo
    • help.getUserInfo
  • Working with updates
    • updates.getChannelDifference
    • updates.getDifference
    • updates.getState
  • Working with user profile pictures
    • photos.deletePhotos
    • photos.getUserPhotos
    • photos.updateProfilePhoto
    • photos.uploadProfilePhoto
  • Working with usernames
    • account.checkUsername
    • account.updateUsername
    • channels.checkUsername
    • channels.updateUsername
    • contacts.resolveUsername
  • Working with VoIP calls
    • phone.acceptCall
    • phone.confirmCall
    • phone.discardCall
    • phone.getCallConfig
    • phone.receivedCall
    • phone.requestCall
    • phone.saveCallDebug
    • phone.sendSignalingData
    • phone.setCallRating
  • Working with wallpapers
    • account.getMultiWallPapers
    • account.getWallPaper
    • account.getWallPapers
    • account.installWallPaper
    • account.resetWallPapers
    • account.saveWallPaper
    • account.uploadWallPaper
Powered by GitBook
On this page
  • Friendly Methods VS Raw API Methods
  • Friendly Methods
  • Raw API Methods

Was this helpful?

  1. Concepts

Available methods

Friendly Methods VS Raw API Methods

GramJS provides two types of methods. friendly methods are a wrapper around Raw API ones that will take care of most things that need to be added manually if the Raw API counterpart was used.

The signature also won't change between updates while Raw API methods are known to change constantly.

So in short only use Raw API methods if you either there isn't a friendly method counterpart or you need more control over it

Friendly Methods

You can access these methods using client.method_name . There isn't a list of them currently but since GramJS uses TS they can be found easily. An example would be the send_message method used like so

await client.sendMessage('me', { message: 'Hello!' })

A full list of friendly methods will be added soon to the docs.

Raw API Methods

Raw API methods are generated automatically from the .tl files which can be found in tl/static/api.tl these methods are generated on each run on Nodejs and are cached in the browser after the first run so make sure to delete the cache if you update the tl schema.

Alongside the methods, a definition file is generated containing all the available methods and their signature.

To use Raw methods you need to import {Api} first

import {Api} from "telegram";
const {Api} = require("telegram");

Then you'll need to create the request you want from it's class. All methods are classes that accept args relevant to their signatures. An example would be

const messageRequest = new Api.messages.SendMessage({peer: "me", message: "hello"})

Your IDE of choice should help you with the name of the args.

Finally, to send the request you would need to use the .invoke() of client

const result = await client.invoke(messageRequest)

The type of result is different depending on the sent request.

A full list of methods will be coming soon to the docs for now you can console.log the variable to inspect it.

PreviousUpdates (events)NextGetMessages

Last updated 4 years ago

Was this helpful?