The project is a technical support chat, with the ability to send messages both from the site page and from Telegram through a chat bot.
- socket.io - library that provides two-way communication based on real-time events based on WebSockets
- node-telegram-bot-api - library for working with Telegram Bot API
- crypto-js - crypto standards library
- mysql2 - MySQL database library
- express - web framework
- chat-app - chat layout on Bootstrap
- LDAP
- MySQL
There are two roles: admin and user. The admin has access to all rooms, the user - only to the one in which he is.
Rooms are formed by hashing a string like: id + <ClientID> + Secret key
. For example: md5("id123qwerty")
.
The connection of the admin to the server is determined by sending a request (query) when connecting (an example of the parameters is below in the configuration file):
io(DOMEN_SERVER, { transports : ['websocket', 'polling', 'flashsocket'], query : {[SERVER_KEY]: SERVER_PSWD} })
Let's consider two examples: when the user is authorized in the telegram bot and when the user is not authorized.
The user sends a message from the site, the message arrives at the server via WebSockets, is written to the database and sent to the admin:
The response from the admin to the user follows the same principle:
The user sends a message from the site or Telegram, the message arrives at the server via WebSockets, is written to the database and sent to the admin:
The response from the admin to the user is sent through the admini panel via WebSockets, comes to the server, is recorded in the database and sent to the user's personal account and to Telegram via the Telegram bot:
The MIT License (MIT)
Copyright © 2022-2024 Dmitry Vyazin