Back to APIs list

Telegram API examples & templates

Use these vals as a playground to view and fork Telegram API examples and templates on Val Town. Run any example below or find templates that can be used as a pre-built solution.
flafi87 avatar
periodical_weather_telegram
@flafi87
interval
An interactive, runnable TypeScript val by flafi87
flafi87 avatar
weather_forecast_in_the_morning
@flafi87
interval
An interactive, runnable TypeScript val by flafi87
arunc avatar
twitterAlert
@arunc
interval
Twitter 𝕏 keyword Alerts Custom notifications for when you, your company, or anything you care about is mentioned on Twitter. 1. Authentication You'll need a Twitter Bearer Token. Follow these instructions to get one. Unfortunately it costs $100 / month to have a Basic Twitter Developer account. If you subscribe to Val Town Pro, I can let you "borrow" my token. Just comment on this val and I'll hook you up. 2. Query Change the query variable for what you want to get notified for. You can use Twitter's search operators to customize your query, for some collection of keywords, filtering out others, and much more! 3. Notification Below I'm sending these mentions to a private channel in our company Discord, but you can customize that to whatever you want, @std/email, Slack, Telegram, whatever.
stevekrouse avatar
telegram
@stevekrouse
script
Message yourself on Telegram This val lets you send yourself Telegram messages via ValTownBot . This ValTownBot saves you from creating your own Telegram Bot. However if I'm being honest, it's really simple and fun to make your own Telegram bot. (You just message BotFather .) I'd recommend most folks going that route so you have an unmediated connection to Telegram. However if you want to have the simplest possible setup to just send yourself messages, read on... Installation It takes less than a minute to set up! Start a conversation with ValTownBot Copy the secret it gives you Save it in your Val Town Environment Variables under telegram Send a message! Usage telegramText import { telegramText } from "https://esm.town/v/stevekrouse/telegram?v=14"; const statusResponse = await telegramText("Hello from Val.Town!!"); console.log(statusResponse); telegramPhoto import { telegramPhoto } from "https://esm.town/v/stevekrouse/telegram?v=14"; const statusResponse = await telegramPhoto({ photo: "https://placekitten.com/200/300", }); console.log(statusResponse); ValTownBot Commands /roll - Roll your secret in case you accidentally leak it. /webhook - Set a webhook to receive messages you send to @ValTownBot Receiving Messages If you send /webhook to @ValTownBot, it will let you specify a webhook URL. It will then forward on any messages (that aren't recognized @ValTownBot commands) to that webhook. It's particularly useful for creating personal chatbots, like my telegram <-> DallE bot . How it works Telegram has a lovely API. I created a @ValTownBot via Bot Father . I created a webhook and registered it with telegram Whenever someone new messages @ValTownBot, I generate a secret and save it along with their Chat Id in @stevekrouse/telegramValTownBotSecrets (a private val), and message it back to them Now whenever you call this val, it calls telegramValTownAPI , which looks up your Chat Id via your secret and sends you a message Telegram Resources Val Town Telegram Echo Bot Guide Telegram <-> DallE Bot Bot Father - the father of all Telegram Bots Telegram Bot Tutorial Credits This val was originally made by pomdtr . Todo [ ] Store user data in Val Town SQLite [ ] Parse user data on the API side using Zod
stevekrouse avatar
telegramValTownAPI
@stevekrouse
http
An interactive, runnable TypeScript val by stevekrouse
stevekrouse avatar
telegramPhotoExample
@stevekrouse
script
An interactive, runnable TypeScript val by stevekrouse
stevekrouse avatar
exampleTelegramMessage
@stevekrouse
script
An interactive, runnable TypeScript val by stevekrouse
stevekrouse avatar
telegramSendMessage
@stevekrouse
script
An interactive, runnable TypeScript val by stevekrouse
stevekrouse avatar
telegramSendPhoto
@stevekrouse
script
An interactive, runnable TypeScript val by stevekrouse
mimos avatar
twitterAlert
@mimos
interval
Twitter 𝕏 keyword Alerts Custom notifications for when you, your company, or anything you care about is mentioned on Twitter. 1. Authentication You'll need a Twitter Bearer Token. Follow these instructions to get one. Unfortunately it costs $100 / month to have a Basic Twitter Developer account. If you subscribe to Val Town Pro, I can let you "borrow" my token. Just comment on this val and I'll hook you up. 2. Query Change the query variable for what you want to get notified for. You can use Twitter's search operators to customize your query, for some collection of keywords, filtering out others, and much more! 3. Notification Below I'm sending these mentions to a private channel in our company Discord, but you can customize that to whatever you want, @std/email, Slack, Telegram, whatever.
sjmre avatar
telegramSendMessage
@sjmre
script
An interactive, runnable TypeScript val by sjmre
maxm avatar
telegramWebhookExample
@maxm
http
An interactive, runnable TypeScript val by maxm
stevekrouse avatar
twitterAlert
@stevekrouse
interval
Twitter 𝕏 keyword Alerts Custom notifications for when you, your company, or anything you care about is mentioned on Twitter. 1. Authentication You'll need a Twitter Bearer Token. Follow these instructions to get one. Unfortunately it costs $100 / month to have a Basic Twitter Developer account. If you subscribe to Val Town Pro, I can let you "borrow" my token. Just comment on this val and I'll hook you up. 2. Query Change the query variable for what you want to get notified for. You can use Twitter's search operators to customize your query, for some collection of keywords, filtering out others, and much more! 3. Notification Below I'm sending these mentions to a private channel in our company Discord, but you can customize that to whatever you want, @std/email, Slack, Telegram, whatever.
pomdtr avatar
twitterAlert
@pomdtr
script
Twitter 𝕏 keyword Alerts Custom notifications for when you, your company, or anything you care about is mentioned on Twitter. 1. Authentication You'll need a Twitter Bearer Token. Follow these instructions to get one. Unfortunately it costs $100 / month to have a Basic Twitter Developer account. If you subscribe to Val Town Pro, I can let you "borrow" my token. Just comment on this val and I'll hook you up. 2. Query Change the query variable for what you want to get notified for. You can use Twitter's search operators to customize your query, for some collection of keywords, filtering out others, and much more! 3. Notification Below I'm sending these mentions to a private channel in our company Discord, but you can customize that to whatever you want, @std/email, Slack, Telegram, whatever.
marksteve avatar
checkEpicTvDiscounts
@marksteve
script
An interactive, runnable TypeScript val by marksteve