npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

nestjs-telegram-helpdesk

v1.4.12

Published

Telegram Helpdesk Bot

Downloads

6

Readme

Description

It is an application designed to make a helpdesk via telegram. When a user writes to the support bot, it forwards the message to the support group, then one member of the support team replies the message, and it is being forwarded to the user.

Features

When a user sends a message to the support chat it will create a ticket which will be forwarded to the staff group. Any admin in the staff group may answer that ticket by just replying to it. Salutation is added automatically. Photos or stickers will be forwarded too.

Currently, the support chat offers these commands (staff commands):

  • /id - returns your telegram id and the group chat id (1234567 -1234567890)
  • /close - close a ticket manually (in case someone writes 'thank you')
  • /reopen - reopen a ticket manually
  • /clear - close all tickets in category or close all tickets in all categories when typed in staff chat

User commands:

  • /start - prints all public support categories
  • /cat - print current support categories

Features:

  • File forwarding from and to user
  • Database for handling open and closed tickets
  • Simple anti spam system
  • Send tickets to different staff groups
  • Anonymize users

Installation

Create a folder for the application, cd into it. Then download and unpack the package here:

$ npm v nestjs-telegram-helpdesk dist.tarball | xargs curl | tar -xz --strip-components=1

Telegram token

To use the Telegram Bot API, you first have to get a bot account by chatting with BotFather.

BotFather will give you a token, something like 123456789:AbCdfGhIJKlmNoQQRsTUVwxyZ.

Configuration

Rename example settings file:

$ mv settings.example.yml settings.yml

Settings

db

Database settings

  • host
  • port
  • username
  • password

redis

Redis for exchange with external process via Bull

optional. Used for support categories update in runtime required if tickets is defined

  • host
  • port

tickets

optional. Used for deletion of closed tickets

  • daysToKeepTickets # How many days to keep closed tickets. 0 for infinite
  • removeTicketsCron # When to launch clean up

bull

Bull queues for external process exchange;

optional, required if "redis" is defined

  • appQueue: "app-queue-name" # sends a message when application starts
  • categoriesQueue: "cat-queue-name" # listens to messages with support categories from external process

botToken

Support bot token

staffChatId

Admin's group. Accumulate messages from all categories

ownerId

Admin's telegram id

spamTime

time (in MS) in which user may send {spamCantMsg} messages

spamCantMsg

Maximum messages in {spamTime} MS

autoCloseTickets

Close tickets after answering

anonymousTickets

Include userid in tickets or not

categories

optional

Array of built-in support categories

  • id: '100500' # category id
  • name: 'Superchat' # category name
  • groupId: '-100500' # telegram group id
  • isPublic: true # public flag

Support categories

Adding support categories allows you to have invitation links:

https://t.me/{helpdesk_bot_name}?start={id}

  • helpdesk_bot_name is your bot's username
  • id is category id from config. Unique string, e.g. UUID

Running the app

Docker

$ docker-compose up -d

PM2

Once

$ npm i -g pm2
$ mv ecosystem.config.example.js ecosystem.config.js

Every time you update the app

$ npm i --only=prod
$ npm run migration:prod
$ pm2 start ecosystem.config.js

License

MIT