![]() |
![]() |
Check the screenshots folder for more.
This chat provides Operators and Customers with the following functions:
- websockets for real time messaging
- images and videos upload (including drag & drop)
- multiple operators can handle multiple customers
- leaving chat / joining chat info
- marking messages as seen
- typing events
- when the customers leave the chat, operators can reply via email
- customers can respond from the emails and come back to chat continuing the conversation
- logging messages in mysql database
- persistent messages on refresh
- persistent customer sessions
- automatic urls previews
- filtering tracking parameters from urls
- bidirectional sanitization
- customer device profiling (os, browser, device)
- responsive customer chat
you'll need to set up a few things like database configurations for the conversations and messages storage, websocket configuration for real time messaging. this file handles the configuration for the index.php (API file) that is responsible with the database management and email settings. Change everything you need. this is the websocket server file, written in Python. Change the port, timezone, cert and key path accordingly. this file is a watchdog that checks if the websocket server is still running. It will restart it automatically if you add this script to your cron for every minute.
Change the cd path to the folder where the websocket python script is located. This file will also restart the websocket server at 3:00 AM to clear eventual overhead. these files are used for the customer and operator chat. You'll need to change the
_self.websocketUrl, // url for the websocket server (just the domain)
_self.apiUrl, // url for your chat index.php (API file)
_self.operatorAvatarUrl, // the url for the operator avatar, it can be like https://yourdomain/assets/img/operator-avatar.png
_self.attachmentsUrl, // the url for the attachments folder
_self.websocketPort // the port for the websocket server, ex 5678
to your desired configuration.
You have an avatar icon in assets/img but you can use your own for the operators.
index.php requires PHP (>= 5.6), MySQL
powerchat_websocket_server.py requires Python 3, Websockets and Pytz, (AsyncIO is included as a standard library starting with Python 3.36) (it will scream for dependencies anyway when you try to run it).
The websicket server requires a SSL Certificate (.crt) and Key (.key) You'll get them from your host provider and even Let's Encrypt works. Just set up the path for them in the python script. Otherwise the websocket server won't work. If you run cPanel you can find them in the /home/yourcpaneluser/ssl folder.
Of course, you will have to open the websocket desired port trough your firewall if you have one.
Customer chat will be available at https:// your url here / path to the client.html (you can replace later this path with your desired application if you plan to integrate it)
If you use the chat with multiple operators, handle the operator name change yourself. The default name is Operator.
Customers are required to write their names and email addresses to join the chat. Make sure you change the Terms and Conditions URL of the agreement checkbox.
In production you will need a second parameter called pwrsid and the value
can be generated with $this->generatePowerSupportSid();
Then remove the following line from the "manageoperator" clause, in index.php
$request["pwrsid"] = $this->generatePowerSupportSid();
Of course, feel free to change this with your own protection measures