class TelegramBotApi extends AnyRef
TelegramBotApi
Official Telegram Bot API wrapper.
- Self Type
- TelegramBotApi with HttpClient
- Alphabetic
- By Inheritance
- TelegramBotApi
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new TelegramBotApi(token: String)
- token
Bot token
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def apiCall(action: String, params: (String, Any)*): Future[JValue]
- Attributes
- protected
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def asyncSetWebhook(url: Option[String], certificate: Option[InputFile] = None): Unit
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- implicit val formats: DefaultFormats.type
- def forwardMessage(chatId: Long, fromChatId: Int, messageId: Int): Future[Message]
forwardMessage
forwardMessage
Use this method to forward messages of any kind. On success, the sent Message is returned.
- chatId
Unique identifier for the message recipient — User or GroupChat id
- fromChatId
Unique identifier for the chat where the original message was sent — User or GroupChat id
- messageId
Unique message identifier
- def getAs[R](action: String, params: (String, Any)*)(implicit arg0: Manifest[R]): Future[R]
- Attributes
- protected
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def getMe: Future[User]
getMe
getMe
A simple method for testing your bot's auth token. Requires no parameters. Returns basic information about the bot in form of a User object.
- def getUpdates(offset: Option[Int] = None, limit: Option[Int] = None, timeout: Option[Int] = None): Future[Array[Update]]
getUpdates
getUpdates
Use this method to receive incoming updates using long polling (wiki). An Array of Update objects is returned.
- offset
Optional Identifier of the first update to be returned. Must be greater by one than the highest among the identifiers of previously received updates. By default, updates starting with the earliest unconfirmed update are returned. An update is considered confirmed as soon as getUpdates is called with an offset higher than its update_id.
- limit
Optional Limits the number of updates to be retrieved. Values between 1—100 are accepted. Defaults to 100
- timeout
Optional Timeout in seconds for long polling. Defaults to 0, i.e. usual short polling Notes
- This method will not work if an outgoing webhook is set up. 2. In order to avoid getting duplicate updates, recalculate offset after each server response.
- def getUserProfilePhotos(userId: Int, offset: Option[Int] = None, limit: Option[Int] = None): Future[UserProfilePhotos]
getUserProfilePhotos
getUserProfilePhotos
Use this method to get a list of profile pictures for a user. Returns a UserProfilePhotos object.
- userId
Unique identifier of the target user
- offset
Optional Sequential number of the first photo to be returned. By default, all photos are returned.
- limit
Optional Limits the number of photos to be retrieved. Values between 1—100 are accepted. Defaults to 100.
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def sendAudio(chatId: Long, audioFile: InputFile, duration: Option[Int] = None, performer: Option[String] = None, title: Option[String] = None, replyToMessageId: Option[Int] = None, replyMarkup: Option[ReplyMarkup] = None): Future[Message]
sendAudio
sendAudio
Use this method to send audio files, if you want Telegram clients to display them in the music player. Your audio must be in the .mp3 format. On success, the sent Message is returned. Bots can currently send audio files of up to 50 MB in size, this limit may be changed in the future. For backward compatibility, when the fields title and performer are both empty and the mime-type of the file to be sent is not audio/mpeg, the file will be sent as a playable voice message. For this to work, the audio must be in an .ogg file encoded with OPUS. This behavior will be phased out in the future. For sending voice messages, use the sendVoice method instead.
- chatId
Unique identifier for the message recipient — User or GroupChat id
- audioFile
Audio file to send. You can either pass a fileId as String to resend an audio that is already on the Telegram servers, or upload a new audio file using multipart/form-data.
- duration
Optional Duration of sent audio in seconds
- performer
Optional. Performer of the audio as defined by sender or by audio tags
- title
Optional. Title of the audio as defined by sender or by audio tags
- replyToMessageId
Optional If the message is a reply, ID of the original message
- replyMarkup
Optional Additional interface options. A JSON-serialized object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user.
- def sendAudioId(chatId: Long, audioId: String, duration: Option[Int] = None, performer: Option[String] = None, title: Option[String] = None, replyToMessageId: Option[Int] = None, replyMarkup: Option[ReplyMarkup] = None): Future[Message]
- def sendChatAction(chatId: Long, action: ChatAction): Unit
sendChatAction
sendChatAction
Use this method when you need to tell the user that something is happening on the bot's side. The status is set for 5 seconds or less (when a message arrives from your bot, Telegram clients clear its typing status). Example: The ImageBot needs some time to process a request and upload the image. Instead of sending a text message along the lines of “Retrieving image, please wait…”, the bot may use sendChatAction with action = upload_photo. The user will see a “sending photo” status for the bot. We only recommend using this method when a response from the bot will take a noticeable amount of time to arrive.
- chatId
Unique identifier for the message recipient — User or GroupChat id
- action
Type of action to broadcast. Choose one, depending on what the user is about to receive: typing for text messages, upload_photo for photos, record_video or upload_video for videos, record_audio or upload_audio for audio files, upload_document for general files, find_location for location data.
- def sendDocument(chatId: Long, documentFile: InputFile, caption: Option[String] = None, replyToMessageId: Option[Int] = None, replyMarkup: Option[ReplyMarkup] = None): Future[Message]
sendDocument
sendDocument
Use this method to send general files. On success, the sent Message is returned. Bots can currently send files of any type of up to 50 MB in size, this limit may be changed in the future.
- chatId
Unique identifier for the message recipient — User or GroupChat id
- documentFile
File to send. You can either pass a fileId as String to resend a file that is already on the Telegram servers, or upload a new file using multipart/form-data.
- replyToMessageId
Optional If the message is a reply, ID of the original message
- replyMarkup
Optional Additional interface options. A JSON-serialized object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user.
- def sendDocumentId(chatId: Long, documentId: String, replyToMessageId: Option[Int] = None, replyMarkup: Option[ReplyMarkup] = None): Future[Message]
- def sendLocation(chatId: Long, latitude: Float, longitude: Float, replyToMessageId: Option[Int] = None, replyMarkup: Option[ReplyMarkup] = None): Future[Message]
sendLocation
sendLocation
Use this method to send point on the map. On success, the sent Message is returned.
- chatId
Unique identifier for the message recipient — User or GroupChat id
- latitude
Latitude of location
- longitude
Longitude of location
- replyToMessageId
Optional If the message is a reply, ID of the original message
- replyMarkup
Optional Additional interface options. A JSON-serialized object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user.
- def sendMessage(chatId: Long, text: String, disableWebPagePreview: Option[Boolean] = None, replyToMessageId: Option[Int] = None, replyMarkup: Option[ReplyMarkup] = None): Future[Message]
sendMessage
sendMessage
Use this method to send text messages. On success, the sent Message is returned.
- chatId
Unique identifier for the message recipient — User or GroupChat id
- text
Text of the message to be sent
- disableWebPagePreview
Optional Disables link previews for links in this message
- replyToMessageId
Optional If the message is a reply, ID of the original message
- replyMarkup
Optional Additional interface options. A JSON-serialized object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user.
- def sendPhoto(chatId: Long, photoFile: InputFile, caption: Option[String] = None, replyToMessageId: Option[Int] = None, replyMarkup: Option[ReplyMarkup] = None): Future[Message]
sendPhotoId
sendPhotoId
Use this method to send photos. On success, the sent Message is returned.
- chatId
Unique identifier for the message recipient — User or GroupChat id
- photoFile
Photo to send. You can either pass a fileId as String to resend a photo that is already on the Telegram servers, or upload a new photo using multipart/form-data.
- caption
Optional Photo caption (may also be used when resending photos by fileId).
- replyToMessageId
Optional If the message is a reply, ID of the original message
- replyMarkup
Optional Additional interface options. A JSON-serialized object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user.
- def sendPhotoId(chatId: Long, photoId: String, caption: Option[String] = None, replyToMessageId: Option[Int] = None, replyMarkup: Option[ReplyMarkup] = None): Future[Message]
- def sendSticker(chatId: Long, stickerFile: InputFile, replyToMessageId: Option[Int] = None, replyMarkup: Option[ReplyMarkup] = None): Future[Message]
sendSticker
sendSticker
Use this method to send .webp stickers. On success, the sent Message is returned.
- chatId
Unique identifier for the message recipient — User or GroupChat id
- stickerFile
Sticker to send. You can either pass a fileId as String to resend a sticker that is already on the Telegram servers, or upload a new sticker using multipart/form-data.
- replyToMessageId
Optional If the message is a reply, ID of the original message
- replyMarkup
Optional Additional interface options. A JSON-serialized object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user.
- def sendStickerId(chatId: Long, stickerId: String, replyToMessageId: Option[Int] = None, replyMarkup: Option[ReplyMarkup] = None): Future[Message]
- def sendVideo(chatId: Long, videoFile: InputFile, duration: Option[Int] = None, caption: Option[String] = None, replyToMessageId: Option[Int] = None, replyMarkup: Option[ReplyMarkup] = None): Future[Message]
sendVideo
sendVideo
Use this method to send video files, Telegram clients support mp4 videos (other formats may be sent as Document). On success, the sent Message is returned. Bots can currently send video files of up to 50 MB in size, this limit may be changed in the future.
- chatId
Unique identifier for the message recipient — User or GroupChat id
- videoFile
Video to send. You can either pass a fileId as String to resend a video that is already on the Telegram servers, or upload a new video file using multipart/form-data.
- duration
Optional Duration of sent video in seconds
- caption
Optional Video caption (may also be used when resending videos by fileId).
- replyToMessageId
Optional If the message is a reply, ID of the original message
- replyMarkup
Optional Additional interface options. A JSON-serialized object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user.
- def sendVideoId(chatId: Long, videoId: String, duration: Option[Int] = None, caption: Option[String] = None, replyToMessageId: Option[Int] = None, replyMarkup: Option[ReplyMarkup] = None): Future[Message]
- def sendVoice(chatId: Long, audioFile: InputFile, duration: Option[Int] = None, performer: Option[String] = None, title: Option[String] = None, replyToMessageId: Option[Int] = None, replyMarkup: Option[ReplyMarkup] = None): Future[Message]
sendVoice
sendVoice
Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message. For this to work, your audio must be in an .ogg file encoded with OPUS (other formats may be sent as Audio or Document). On success, the sent Message is returned. Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future.
- chatId
Unique identifier for the message recipient — User or GroupChat id
- audioFile
Audio file to send. You can either pass a file_id as String to resend an audio that is already on the Telegram servers, or upload a new audio file using multipart/form-data.
- duration
Optional Duration of sent audio in seconds
- replyToMessageId
Optional If the message is a reply, ID of the original message
- replyMarkup
Optional Additional interface options. A JSON-serialized object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user.
- def sendVoiceId(chatId: Long, audioId: String, duration: Option[Int] = None, performer: Option[String] = None, title: Option[String] = None, replyToMessageId: Option[Int] = None, replyMarkup: Option[ReplyMarkup] = None): Future[Message]
- def setWebhook(url: Option[String], certificate: Option[InputFile] = None): Unit
setWebhook
setWebhook
Use this method to specify a url and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified url, containing a JSON-serialized Update. In case of an unsuccessful request, we will give up after a reasonable amount of attempts. If you'd like to make sure that the Webhook request comes from Telegram, we recommend using a secret path in the URL, e.g. www.example.com/<token>. Since nobody else knows your bot‘s token, you can be pretty sure it’s us.
- url
Optional HTTPS url to send updates to. Use an empty string to remove webhook integration
- certificate
Optional Upload your public key certificate so that the root certificate in use can be checked Notes
- You will not be able to receive updates using getUpdates for as long as an outgoing webhook is set up. 2. To use a self-signed certificate, you need to upload your public key certificate using certificate parameter. Please upload as InputFile, sending a String will not work. 3. Ports currently supported for Webhooks: 443, 80, 88, 8443.
- def syncApiCall(action: String, params: (String, Any)*): JValue
- Attributes
- protected
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated