PureTelegram (framework for using the Telegram API)

Share your advanced PureBasic knowledge/code with the community.
infratec
Always Here
Always Here
Posts: 7577
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: PureTelegram (framework for using the Telegram API)

Post by infratec »

comment it out.

Or:

Code: Select all

CompilerIf #PB_Compiler_Version < 600
  InitNetwork()
CompilerEndIf
dibor
Enthusiast
Enthusiast
Posts: 160
Joined: Wed May 20, 2020 5:19 pm
Location: The 3rd planet in the Solar System
Contact:

Re: PureTelegram (framework for using the Telegram API)

Post by dibor »

Hi.
Thank U, I did that, but doesn't help
I got error: ERROR: *{"ok":false,"error_code":404,"description":"Not Found"}* with simple example:

Code: Select all

XIncludeFile "PureTelegram.pbi"
#BotAPIToken = "[your bot's API token]"
#ChatID = "[your chat's ID or username]"

txt.s = "Hello Telegram world."
mid.i = Telegram_PostText(#BotAPIToken,#ChatID,txt)
Of course I put API token and ChatID

What I do wrong?
Mac Studio M1Max, PB 6.12 Arm64 and x64.
Macbook Air M2, PB 6.12 Arm64 and x64.
Windows 10, PB 6.12 x64 and x86.
User avatar
Caronte3D
Addict
Addict
Posts: 1355
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Re: PureTelegram (framework for using the Telegram API)

Post by Caronte3D »

dibor wrote: Wed Jun 25, 2025 10:45 am Of course I put API token and ChatID
Your ChatID start with a: "-" (minus sign)?
If not, try to add it and test it again.
dibor
Enthusiast
Enthusiast
Posts: 160
Joined: Wed May 20, 2020 5:19 pm
Location: The 3rd planet in the Solar System
Contact:

Re: PureTelegram (framework for using the Telegram API)

Post by dibor »

Hi
I did exact as in the module help.
ChatID with @username or chat number
Have tried with and w/o "-" , doesn't work :(

:(
Mac Studio M1Max, PB 6.12 Arm64 and x64.
Macbook Air M2, PB 6.12 Arm64 and x64.
Windows 10, PB 6.12 x64 and x86.
User avatar
Caronte3D
Addict
Addict
Posts: 1355
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Re: PureTelegram (framework for using the Telegram API)

Post by Caronte3D »

For me, this works in a Telegram Group (the group must be open to everybody).

BTW... Have you created and added the Telegram bot to the group?
dibor
Enthusiast
Enthusiast
Posts: 160
Joined: Wed May 20, 2020 5:19 pm
Location: The 3rd planet in the Solar System
Contact:

Re: PureTelegram (framework for using the Telegram API)

Post by dibor »

I did it privet, will do public and will check.

Thank U
Mac Studio M1Max, PB 6.12 Arm64 and x64.
Macbook Air M2, PB 6.12 Arm64 and x64.
Windows 10, PB 6.12 x64 and x86.
dibor
Enthusiast
Enthusiast
Posts: 160
Joined: Wed May 20, 2020 5:19 pm
Location: The 3rd planet in the Solar System
Contact:

Re: PureTelegram (framework for using the Telegram API)

Post by dibor »

Caronte3D wrote: Wed Jun 25, 2025 11:18 am BTW... Have you created and added the Telegram bot to the group?
Yes
Mac Studio M1Max, PB 6.12 Arm64 and x64.
Macbook Air M2, PB 6.12 Arm64 and x64.
Windows 10, PB 6.12 x64 and x86.
dibor
Enthusiast
Enthusiast
Posts: 160
Joined: Wed May 20, 2020 5:19 pm
Location: The 3rd planet in the Solar System
Contact:

Re: PureTelegram (framework for using the Telegram API)

Post by dibor »

Nothing work :(
Looks like I am too stupid :(
Mac Studio M1Max, PB 6.12 Arm64 and x64.
Macbook Air M2, PB 6.12 Arm64 and x64.
Windows 10, PB 6.12 x64 and x86.
User avatar
Caronte3D
Addict
Addict
Posts: 1355
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Re: PureTelegram (framework for using the Telegram API)

Post by Caronte3D »

Check if your tokens look like mine:

Code: Select all

#ChatIDWD      = "-1305835971919" ; GroupID
#BotAPITokenWD = "5640952673:AAB2ZZ1Vq6peruVnwIxYbu3qrgE68pyaKX8"
Telegram_PostText(#BotAPITokenWD, #ChatIDWD, "⚠️ Warning!")
BTW: obviously on this example I modified my tokens, but you can get an idea of form.
dibor
Enthusiast
Enthusiast
Posts: 160
Joined: Wed May 20, 2020 5:19 pm
Location: The 3rd planet in the Solar System
Contact:

Re: PureTelegram (framework for using the Telegram API)

Post by dibor »

Hi.
My example looks same:

Code: Select all

XIncludeFile "PureTelegram.pbi"
#BotAPIToken = "[7620816597:AAHhBvBM9qqlZ1arXJKmhFGTR_EfFcwaPGk]"
#ChatID = "[1701234043]"

txt.s = "Test"
mid.i = Telegram_PostText(#BotAPIToken,#ChatID,txt)
Mac Studio M1Max, PB 6.12 Arm64 and x64.
Macbook Air M2, PB 6.12 Arm64 and x64.
Windows 10, PB 6.12 x64 and x86.
dibor
Enthusiast
Enthusiast
Posts: 160
Joined: Wed May 20, 2020 5:19 pm
Location: The 3rd planet in the Solar System
Contact:

Re: PureTelegram (framework for using the Telegram API)

Post by dibor »

I am stupid idiot, was use [] .
As was in the example:

Code: Select all

#BotAPIToken = "[your bot's API token]"
#ChatID = "[your chat's ID or username]"
:oops:
Mac Studio M1Max, PB 6.12 Arm64 and x64.
Macbook Air M2, PB 6.12 Arm64 and x64.
Windows 10, PB 6.12 x64 and x86.
User avatar
Caronte3D
Addict
Addict
Posts: 1355
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Re: PureTelegram (framework for using the Telegram API)

Post by Caronte3D »

You're welcome! :lol:
Post Reply