Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/deptyped/notepher-bot

Note-taking Telegram Mini App
https://github.com/deptyped/notepher-bot

telegram telegram-bot telegram-mini-app telegram-miniapp-contest-2023 telegram-web-app

Last synced: about 2 months ago
JSON representation

Note-taking Telegram Mini App

Awesome Lists containing this project

README

        







Notepher Bot


[Notepher](https://t.me/NotepherBot) is an intuitive note-taking [Telegram Mini App](https://core.telegram.org/bots/webapps) 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](https://core.telegram.org/bots/webapps#cloudstorage) 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](./README_USER.md).

## Launch

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

1. **Clone Repository**

```bash
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:

```bash
cd apps/web-app
```

Run the following command to build the web app:
```bash
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](./apps/web-app/README.md)

3. **Configure the Menu Button**

- Open the Telegram app and search for "[@BotFather](https://t.me/BotFather)".
- Start a chat with [@BotFather](https://t.me/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.

4. **Environment Variables Setup**

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

```bash
cd ../bot
```

Create an environment variables file by copying the provided example file:
```bash
cp .env.example .env
```
Open the newly created `.env` file and set the `BOT_TOKEN` environment variable. This token should be obtained from [@BotFather](https://t.me/BotFather).

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

5. **Launching the Bot**

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

**Development Mode:**

Install the required dependencies:
```bash
npm install
```
Start the bot in watch mode (auto-reload when code changes):
```bash
npm run dev
```

**Production Mode:**

Install only production dependencies (no development dependencies):
```bash
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.
```dotenv
NODE_ENV=production
BOT_WEBHOOK=
```

Start the bot in production mode:
```bash
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.