Message yourself on Telegram

Inspired by, this val lets you send yourself Telegram messages via the Val Town Telegram Bot. You can use it to make custom Telegram bots, such as this DallE one.


@stevekrouse.telegram(@me.secrets.telegram, "hi to me on telegram!")
@me.t("hello telegram!")


It takes less than a minute to set up!

  1. Start a conversation with ValTownBot

  2. Copy the secret it gives you

  3. Save it in your Val Town secrets under telegram

  4. Send a message!

@stevekrouse.telegram(@me.secrets.telegram, "hi to me on telegram!")


  1. (Bonus) Make a helper function

If you want to make it even easier to message yourself on telegram, ie @me.t("hello!") then you can setup a helper function:

Create vallet t = (message, options) => @stevekrouse.telegram(@me.secrets.telegram, message, options);

Ensure you keep this function private otherwise anyone can message you on Telegram!


  • /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.

  1. I created a @ValTownBot via Bot Father.
  2. I created a webhook and registered it with telegram
  3. 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
  4. Now whenever you call this val, it calls telegramValTownBot via the Run API (api is a helper), which looks up your Chat Id via your secret and sends you a message

Telegram Resources


This val was originally made by pomdtr.

import { runVal } from "";
export async function telegram(secret: string, text: string, options?) {
return runVal("stevekrouse.telegramValTownBot", secret, text, options);
// Forked from @pomdtr.telegram
👆 This is a val. Vals are TypeScript snippets of code, written in the browser and run on our servers. Create scheduled functions, email yourself, and persist small pieces of data — all from the browser.