Urban Bot

Urban Bot

  • Docs
  • GitHub

›Getting Started

Getting Started

  • Intro
  • Telegram

Tutorials

  • Todo List

API

  • Components
  • Hooks
  • Bots

    • Telegram
    • Discord
    • Facebook
    • Slack

Telegram

Instruction on how to start developing Telegram bot.

Local development

Video

Steps

  1. To start work with telegram you have to get telegram token from @BotFather. Write to BotFather /newbot, write display name of your new bot, then username and you should get telegram token.

alt-text

  1. Then open my-app directory which you have install via create-urban-bot and paste the telegram token to .env file.

    telegram token in .env telegram-token-env

  2. After this open src/index.ts or src/index.js and uncomment // import './render/telegram';

    src/index telegram-token-env

  3. Your bot is ready to launch! Run npm run dev in my-app directory and write something to your bot. It should work as default app with two commands /echo and /logo.

If you see error looks like error: [polling_error] {"code":"EFATAL","message":"EFATAL: Error: connect ECONNREFUSED 127.0.0.1:9150"} probably an internet provider blocks Telegram connection. You need to use a VPN, or you could use the Tor browser, see the example.

Deploy

Heroku

Video

Steps

  1. Register on heroku and install heroku cli and run heroku login in a terminal.

  2. Go to a new app and create a new.

  3. Go to your local urban-bot app folder if you have already one. For a new app do the first three steps.

  4. Paste heroku app url to .env file as WEBHOOK_HOST. You could get it from "Open app" button.

    heroku open app button heroku-open-app

  5. Run npx urban-bot set-webhook telegram in a terminal from your local urban-bot app folder.

  6. Paste telegram token to "Config Vars" section as TELEGRAM_TOKEN in heroku app settings https://dashboard.heroku.com/apps/<YOUR_APP_NAME>/settings.

    heroku config vars heroku-config-vars

  7. Run git init in your local urban-bot app folder if you did not.

  8. Add git remote by run heroku git:remote -a <YOUR_APP_NAME>.

  9. Deploy.

git add .
git commit -am "make it better"
git push heroku master -u
  1. Check your bot!
← IntroTodo List →
  • Local development
    • Video
    • Steps
  • Deploy
    • Heroku
Docs
Get StartedComponentsHooksTelegramDiscordFacebookSlack
Community
Telegram
Links
Urban Bot
Copyright © 2022 German Smirnov and Ivan Pakhotin