Telegram Template to get you started with your telegram bot projects
For the golang bot api library docs click Here
This install assumes you are already running Git,
Make sure you you have Golang installed on your machine
Telegram bot Token from BotFather
NB You must set bot token in config.json
NB You must set bot token in config.json
1.Clone this repository using git clone https://github.com/mashaole/telegramtemplate.git
2.Run make tidy
to install required packages and add a vendor to your repo
3.Run make start
NB You must set bot token in config.json
1.Clone this repository using git clone https://github.com/mashaole/telegramtemplate.git
on gcp project terminal Cloud Shell
2.Run make tidy
to install required packages and add a vendor to your repo
3.Run go build
4.Run gcloud app deploy
5.Open terminal and perform curl to set Telegram messages to your bot url curl --data "url=(Custom Url)/(handled route)" https://api.telegram.org/bot(botToken)/SetWebhook
E.g curl --data "url=https://mywbesite.com/bsjhdbsakjbdjks" https://api.telegram.org/bot1234567890:kdjakjsdlksajdkl-sldlakslk-aklsjhdkjha/SetWebhook
- Telegram is initiated using
InitTelegram()
and theres a implentation forlocal environemnt
andserver environement
(uses web hooks) - The
deleteChatHistory()
funtion is to clear screen when there is a new update. - The
TelegramHandler()
function handles updates from inline or simple keyboard. - The
SendSimpleMessage()
function handles sending simple message. - The
SendInlineMessage()
function handles sending Inline message. - The
EditMessage()
function handles editing message. - The
CreateSimpleKeyBoard()
returns Simlple Keyboard. - The
CreateInlineKeyBoard()
returns Inline Keyboard.