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.
For more details, check out User Guide.
Follow these steps to set up and run your bot using this repository:
Clone Repository
git clone https://github.com/deptyped/notepher-bot.git
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
Configure the Menu Button
/setmenubutton
command to see your bot list and select the bot you want to configure the menu button.Congrats! Web App is deployed and available to bot users.
[!NOTE] At this stage web app is fully functional, further steps are optional.
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).
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
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.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. |