aad / telgraf
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 6
Watchers: 1
Forks: 3
Open Issues: 0
Type:project
pkg:composer/aad/telgraf
Requires
- ext-json: *
- monolog/monolog: ^2.2
- ramsey/uuid: ^4.1
- respect/validation: ^2.2
Requires (Dev)
- swoole/ide-helper: @dev
This package is auto-updated.
Last update: 2025-10-10 21:39:01 UTC
README
Simple live support server with PHP Swoole Websocket and Telegram API.
Usage
Server Setup
- Clone repository with following command.
git clone https://github.com/ademalidurmus/telgraf.git
- Enter project folder with cd telgrafcommand.
- Update initial credentials (BOT_TOKEN, APP_SECRET and APP_CHAT_IDS) from .env.examplefile via any text editor.
- You can use some makefile commands for configurations. Makefile commands like make [COMMAND], for details you can run make help.- Use make envcommand for create environment file.You need update initial credentials from .env.examplefile before using makefile commands. If you were runmake .envcommand, you may need update.envand.env.examplefiles at the same times.
- Run make buildfor building telgraf application. This command also runcomposer installfor dependency installation and serves the application.
- If you are already built app, and you need just serve app you can run make up. For restart app server you can runmake restart, for stop app server you can also runmake stop.
- For access to cli or container bash you can run make cli.
- make statuscommand is shows containers status like- docker ps. If you want to show telgraf logs you can use- make logscommand.
- make set_webhookcommand setting telegram bot webhook using defined environments.
- make delete_webhookcommand delete telegram bot webhook using defined environments.
- make cleancommand stops telgraf server, delete- .envfile and clear all log files.
 
- Use 
Telegram Bot Commands
- /startcommand is for the starting agent session to accept any client connections.
- /stopcommand is for the stopping agent session.
- /closecommand is for the stopping current client connection. The agent will continue to wait for any connection.
- /add [CHAT_ID]command is used to add a new agent to the agent access control list.
- /remove [CHAT_ID]command for removing the agent from the agent access control list.
API Docs
wss://{your_webserver_url}
- type: enum(message|info), action type
- content: string, message text or action details
- attributes: object, message attributes- attributes.name: string, client name
 
Sample websocket message history:
❌ Disconnected from wss://telgraf.durmus.me
⬇️ {"type":"info","content":"connection unassigned","attributes":[]}
⬆️ {"type":"message","content":"Test Client Message 2","attributes":{"name":"Client 1"}}
⬇️ {"type":"message","content":"Test Message 2","attributes":{"name":"Adem Ali D."}}
⬆️ {"type":"message","content":"Test Client Message 1","attributes":{"name":"Client 1"}}
⬇️ {"type":"message","content":"Test Message 1","attributes":{"name":"Adem Ali D."}}
⬇️ {"type":"info","content":"connection assigned","attributes":[]}
✔️ Connected to wss://telgraf.durmus.me
License
MIT