telegram机器人bot使用Webhook
机器人webhook应用
删除hook api
https://api.telegram.org/bot(token)/deleteWebhook
设置hook api
https://api.telegram.org/bot(token)/setwebhook?url=https://xx.com
url机器人接收信息回调网站
机器人webhook应用
删除hook api
https://api.telegram.org/bot(token)/deleteWebhook
设置hook api
https://api.telegram.org/bot(token)/setwebhook?url=https://xx.com
url机器人接收信息回调网站
机器人命令介绍
初始化
https://api.telegram.org/bot(token)/getUpdates
中间就 (token) 替换申请好的token
接收信息api
https://api.telegram.org/bot(token)/getUpdates
返回是个json字符串
https://api.telegram.org/bot(token)/sendMessage?chat_id=876377091&text=123123123123123
chat_id 对方接收信息的form 字符串里面的ID字段的ID
text 发送的信息
登录Telegram,并找到@BotFather
我们使用/new bot指令
官方机器人回复:
Alright, a new bot. How are we going to call it? Please choose a name for your bot.
问:你的机器人叫名字 并且已 bot结尾 列: xxxbot 这个就是机器人名字!
官方机器人回复:
Sorry, this username is already taken. Please try something different.
问:设置机器人账号 并且也是已 bot结尾 列:xxxzzbot 这个就是机器人账号
最后回复:
Done! Congratulations on your new bot. You will find it at t.me/xguubot. You can now add a description, about section and profile picture for your bot, see /help for a list of commands. By the way, when you've finished creating your cool bot, ping our Bot Support if you want a better username for it. Just make sure the bot is fully operational before you do this.
Use this token to access the HTTP API:
* 这个就是机器人的token 我用星号代表
Keep your token secure and store it safely, it can be used by anyone to control your bot.
For a description of the Bot API, see this page: https://core.telegram.org/bots/api 这个就是开发api文档