To start work, you need to fill in the configuration file js/const.js
:
//URL of the admin panel folder
const DOMEN = 'http://test.com/';
//Company logo
const LOGO_COMPANY = 'socketgram.io.min.png';
//Chat Server URL
const DOMEN_SERVER = 'https://your.domen.com/';
You also need to set the sessionStorage
values (you can use an Ajax request):
sessionStorage.setItem("id", "Client ID (for example: 123)");
sessionStorage.setItem("room", "Room hash");
The client panel handles the following events:
socket.on('new message', (
{
username: username, //Client ID (for example: 123)
message: message, //Message
label: label, //Message ID
date: date, //Date and time
adm: login_admin //Administrator name (if the message was written by the client, the parameter is 0)
}) => {}); //Message from admin/user
socket.on('new message history', (
{
username: username, //Client ID (for example: 123)
message: message, //Message
label: label, //Message ID
date: date, //Date and time
adm: login_admin //Administrator name (if the message was written by the client, the parameter is 0)
}) => {}); //Uploading message history
socket.on('drop history button',() => {}); //Removing the download history button
socket.on('add history button',() => {}); //Adding a button to load the message history
Calling /start
starts the telegram bot:
By pressing Contacts
, the contacts of the company are displayed:
By clicking Log in to PA
, the authorization process begins:
If the username/password is incorrect, the following message appears:
With correct authorization, the menu changes:
To write to technical support, you need to click the Write a message to technical support
button: