B4J Library [BETA] jTelegramBot - Create your own Telegram Bot

jTelegramBot is a partially wrapper build on this github project.
This project is licensed under The MIT License (MIT). See LICENSE for more details.

Note that the development has stopped. If you miss something in the lib you need to add it by yourself. The Source is attached to this post.

links about Telegram Bots

DonManfred (Wrapper)
Version: 0.31

- To get the Example running you first need to adapt the Initialize line with your Bots Name and ApiToken.
Sub AppStart (Args() As String)
End Sub
- The Example is using Static Filenames for the Document, MP3, Photo, Sticker send.
Make sure to adapt the path and Filenames to match Files you want to use.

    If message.Text = "/buttons" Then
        Dim mark As InlineKeyboardMarkup
        Dim buttons As Message = jtb.sendMessage(jtb.byId(from.Id),"Click the Button!","MARKDOWN",False,False,message.MessageId,mark)
    else If message.Text = "/location" Then
    else If message.Text = "/url" Then
        jtb.sendMessage(jtb.byId(from.Id),"[jTelegramBot Thread](https://www.b4x.com/android/forum/threads/jtelegrambot.103778/#post-650611)","MARKDOWN",False,False,message.MessageId,Null)
    else If message.Text = "/plainurl" Then
        bld.sendMessage(chat.Id,"Link without Preview [jTelegramBot Thread](https://www.b4x.com/android/forum/threads/jtelegrambot.103778/#post-650611)",message.MessageId,False,True,Null,jtb.parsemodeMARKDOWN)
    else If message.Text = "/text" Then
        jtb.sendMessage(jtb.byId(from.Id),$"Testtext <b>Bold</b>, <i>Italic</i>
    new row..."$,"HTML",True,False,message.MessageId,Null)
    else If message.Text = "/document" Then
    else If message.Text = "/photo" Then
    else If message.Text = "/audio" Then
        jtb.sendAudio(jtb.byId(from.Id),jtb.MediaByFile(File.DirApp,"myaudio.mp3"),223,"Fleedwood Mac","Eyes of the World",False,message.MessageId,replbld.forceReply)
    else If message.Text = "/sticker" Then
    else If message.Text = "/start" Then
        jtb.sendMessage(jtb.byId(from.Id),$" Hello ${chat.Username}
`Command   | Result
/location | Returns a Locationobject
/document | Returns a Document
/photo    | Returns a Photo
/audio    | Returns a Audiofile
/url      | Returns a URL with Preview
/plainurl | Returns a URL without Preview
/buttons  | Shows some buttons To Click on
Thank you For choosing Me :-)"$,"MARKDOWN",False,False,message.MessageId,Null)

In this example you need to replace the following Filereferences:
- mydocument.zip
- myimage.png
- myaudio.mp3
- mysticker.webp

Due to the Size of the needed Additional JARs they can be downloaded

For any Question/Issue you have please Create a new Thread in the B4J Questionsforum.


  • BotExample.zip
    2.5 KB · Views: 676
  • JTelegramBotV0.31.zip
    256.4 KB · Views: 449
  • src.zip
    188 KB · Views: 406
Last edited:


Licensed User
how can pinn a message ???
missing pin message method
1. You should always create a new thread in the b4j questionsforum for any Question you have. Just make sure to note that you are using jTelegramBot library version xx

See my comment from #1!
For any Question/Issue you have please Create a new Thread in the B4J Questionsforum.

2. Seems it is not implemented in the Github project. I could not find anything about Pinning in the Sources.


Well-Known Member
Licensed User
Hi, sorry in advance, I'm reading a lot of posts and I got confused, what I need to install and how to start using this library?


Licensed User
As written in #1 of this thread you should create a new Thread for any question/issue you have in the Questionsforum.

The answer is:
An example is attached to the 1st post,
the library is there too. You need to copy it to the additional libs folder.
Also note to download the additional files (See the DOWNLOAD link in #1) and copy them to the additional libs folder too.


Licensed User
Can bot read messages from Privat Telegram channel (only read channel)?
1. You should ALWAYS(!) create a new thread in the Questionsforum for any question/issie you have! Posting to existing threads is a Mistake.
2. If the bot is added to a channel then he gets all Messages in this channel. If you send a private message to the bot the bot can read this private message and respond to it using the channel id.


Well-Known Member
Licensed User
what is message.MessageId ?

Next version will have a possibility to change the InlineKeyboard. In the 1st version only a dummykeyboard is generated inside the library which could not be changed.

        Dim ibld As InlineKeyboardButtonBuilder
        Dim mark As InlineKeyboardMarkup
        Dim buttons As Message = jtb.sendMessage(jtb.byId(from.Id),"Click the Button!","MARKDOWN",False,False,message.MessageId,mark)



Active Member
Licensed User
Hello @DonManfred , Firstly thank you for wrapping this library. I have been playing around with this for the last 3 days and I believe there are a lot of things that could be done using a bot.

Question if I may ask. the Original library is about 4 years since any changes (not complaining :)) and I am not sure if the Author is maintaining it. I would love to integrate this into my application. Would you still recommend using it for a long term client-facing production application?

Thank you for the source, just checking if it is the latest?

Have a nice day!


Licensed User


New Member
in v 0.31
bad class file: C:\Program Files (x86)\Anywhere Software\B4J\libraries\jtelegrambot.jar(de/donmanfred/JTBwrapper.class)
class file has wrong version 55.0, should be 52.0
Please remove or make sure it appears in the correct subdirectory of the classpath.

help please

Toky Olivier

Active Member
Licensed User
Hello, I tried your bot in Telegram, is it normal like this please? No response from the bot. It's the first time I used Telegram.
Thank you


Licensed User
Hello, I tried your bot in Telegram, is it normal like this please?
The Bot example does not have any UI.
You need to check the log for any events which are raised.

Based on the Screenshot the messages did arrived at the Bot. I expect it to be a Screenshot from Telegramclient.

Run the Bot from the Ide and monitor the logs, see what message is coming in and how your Bot is handling this Message.

I can not help more as you did not provided any useful informations.

Away from that you should ALWAYS create a new Thread for any Question/Issue you have in the Quetionsforum.
Make sure to post all relevant code from your Bot to see what you are doing and how.
Best is to upload a small project (without your token)....
Last edited: