You can create Telegram bots using vals.
In this example, you’ll create a val that uses the HTTP Val to receive webhooks from Telegram.
When users message your bot, the bot will reply with the same message.
@BotFather
Speak to Telegram’s https://t.me/botfather to create your bot and obtain a bot token.
Copy the bot token you just received and save it as a Val Town secret as telegramBotToken
.
Call @vtdocs.telegramGetMe
with your newly created secret to check that it works.
https://www.val.town/embed/vtdocs.getMeExample
Generate a random string and save it as a Val Town secret as telegramWebhookSecret
.
When Telegram users send messages to your bot, they will be forwarded to your webhook handler. We’ll use the secret we just created to verify that the message came from our bot.
Fork this val that uses the HTTP Val :
https://www.val.town/embed/neverstew.telegramWebhookEchoMessage
Use @vtdocs.telegramSetWebhook
to tell your bot where to send webhooks.