Skip to content

deptyped/notepher-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Notepher is an intuitive note-taking Telegram Mini App designed to effortlessly capture your ideas, to-do lists, and important information. Stay organized and productive without leaving your favorite messenger.

Features

  • Offline First. Notes are stored locally and synchronized when an internet connection is available.
  • Synced. Notepher leverages the power of Telegram Cloud Storage to keep your notes in sync across all your devices.
  • Seamless. Interface colors match your app theme.
  • Organized. Tag your notes and filter them by tags, pin the most important notes at the top.
  • Search. Instantly search through all your notes.
  • Powerful. Formatting, text highlighting, editing history, lists and to-do lists.

For more details, check out User Guide.

Launch

Follow these steps to set up and run your bot using this repository:

  1. Clone Repository

    git clone https://github.com/deptyped/notepher-bot.git
  2. Build and Deploy Web App

    After cloning the repository, navigate to the web-app directory:

    cd apps/web-app

    Run the following command to build the web app:

    npm run build

    This command will generate build output resources inside the dist directory. You can now deploy these resources as a regular static website to your hosting provider of choice.

    For information on launching the web app in developer mode, please refer to apps/web-app/README.md

  3. Configure the Menu Button

    • Open the Telegram app and search for "@BotFather".
    • Start a chat with @BotFather.
    • Use the /setmenubutton command to see your bot list and select the bot you want to configure the menu button.
    • Follow the prompts to set up the menu button with the URL obtained in the previous step.
    • After that, the menu button will be available to users when they interact with your bot.

Congrats! Web App is deployed and available to bot users.

Note

At this stage web app is fully functional, further steps are optional.

  1. Environment Variables Setup

    Once you have completed the web app build and deployment, navigate to the apps/bot directory:

    cd ../bot

    Create an environment variables file by copying the provided example file:

    cp .env.example .env

    Open the newly created .env file and set the BOT_TOKEN environment variable. This token should be obtained from @BotFather.

    Set the WEB_APP_URL environment variable with the URL obtained during the web app deployment (step 2).

  2. Launching the Bot

    You can run your bot in both development and production modes.

    Development Mode:

    Install the required dependencies:

    npm install

    Start the bot in watch mode (auto-reload when code changes):

    npm run dev

    Production Mode:

    Install only production dependencies (no development dependencies):

    npm install --only=prod

    Set the NODE_ENV environment variable to "production" in your .env file. Also, make sure to update BOT_WEBHOOK with the actual URL where your bot will receive updates.

    NODE_ENV=production
    BOT_WEBHOOK=<your_webhook_url>

    Start the bot in production mode:

    npm start
    # or
    npm run start:force # if you want to skip type checking

List of Available Commands

  • npm run lint — Lint source code.
  • npm run format — Format source code.
  • npm run typecheck — Run type checking.
  • npm run dev — Start the bot in development mode.
  • npm run start — Start the bot.
  • npm run start:force — Start the bot without type checking.

Environment Variables

Variable Type Description
NODE_ENV String Specifies the application environment. (development or production)
BOT_TOKEN String Telegram Bot API token obtained from @BotFather.
WEB_APP_URL String HTTPS link to Web App.
LOG_LEVEL String Optional. Specifies the application log level.
For example, use info for general logging. View the Pino documentation for more log level options.
Defaults to info.
BOT_MODE String Optional. Specifies method to receive incoming updates. (polling or webhook)
BOT_WEBHOOK String Optional in polling mode. Webhook endpoint URL, used to configure webhook in production environment.
BOT_SERVER_HOST String Optional. Specifies the server hostname.
Defaults to 0.0.0.0.
BOT_SERVER_PORT Number Optional. Specifies the server port.
Defaults to 80.
BOT_ALLOWED_UPDATES Array of String Optional. A JSON-serialized list of the update types you want your bot to receive. See Update for a complete list of available update types.
Defaults to an empty array (all update types except chat_member).
BOT_ADMINS Array of Number Optional. Administrator user IDs. Use this to specify user IDs that have special privileges, such as executing /setcommands.
Defaults to an empty array.