Bots are small applications that run entirely within the Telegram app. Users interact with bots through flexible interfaces that can support any kind of task or service.

with Bots you can do:

  • replace entire website
  • receive payment
  • create custom tool
  • integrate with other service
  • host games
  • build social network

Accessing Telegram API

  • access Telegram API
  • local API Bot

 

Installing Local API Bot Server.

source code can be downloaded from this link

git clone --recursive https://github.com/tdlib/telegram-bot-api.git
cd telegram-bot-api
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
cmake --build . --target install

once finished you will see this

ubuntu@worker:~/git/telegram-bot-api/build$ sudo cmake –build . –target install
[ 1%] Built target tdsqlite
[ 1%] Built target generate_mime_types_gperf
[ 1%] Built target tdmime_auto
[ 23%] Built target tdutils
[ 25%] Built target tdactor
[ 29%] Built target tddb
[ 30%] Built target memprof
[ 32%] Built target tdtl
[ 33%] Built target generate_common
[ 33%] Built target tl-parser
[ 33%] Generate TLO files
[ 33%] Built target tl_generate_tlo
[ 33%] Generate common TL source files
[ 33%] Built target tl_generate_common
[ 35%] Built target tdapi
[ 39%] Built target tdnet
[ 97%] Built target tdcore
[100%] Built target telegram-bot-api
Install the project…
— Install configuration: “Release”
— Installing: /usr/local/bin/telegram-bot-api

 

Create New bot

  • click /newbot
  • click on the token authorization
  • access the bot using following format https://api.telegram.org/bot<token>/METHOD_NAME

simplest query is getMe

https://api.telegram.org/bot<token>/getMe

output:

{
    “ok”: true,
    “result”: {
        “id”: 5823055985,
        “is_bot”: true,
        “first_name”: “KoplakBot”,
        “username”: “koplak100_bot”,
        “can_join_groups”: true,
        “can_read_all_group_messages”: false,
        “supports_inline_queries”: false
    }
}

 

Leave a Reply

Your email address will not be published. Required fields are marked *