Files
MeshBot/README.md
T

43 lines
1.2 KiB
Markdown

# mesh-bot
Minimal NestJS bot for Meshtastic. Long-running service that TCP-connects to a
Meshtastic serial bridge (raw socat pipe) at `192.168.1.4:4003`, parses inbound
protobuf frames, logs received text messages, and exposes HTTP endpoints to send text.
## Local run
```sh
npm i
npm run start:dev
```
## Docker
```sh
docker compose up -d --build
```
Exposed via Traefik only (no published ports) at `http://bot.dev.kkhost.pl`.
## Endpoints
- `GET /status` — `{ connected, myNodeNum, host, port }`
- `POST /send` — body `{ "text": "...", "to"?: <node number | "!b" | "broadcast"> }`, returns `{ id }`
```sh
curl http://localhost:3000/status
curl -X POST http://localhost:3000/send -H 'content-type: application/json' -d '{"text":"hi"}'
curl -X POST http://localhost:3000/send -H 'content-type: application/json' -d '{"to":123456789,"text":"hello"}'
```
`to` omitted, `"!b"`, or `"broadcast"` sends to the broadcast address `0xffffffff`.
## Env vars
- `MESH_HOST` (default `192.168.1.4`) — bridge host
- `MESH_PORT` (default `4003`) — bridge port
- `PORT` (default `3000`) — HTTP listen port
Note: the serial bridge accepts only ONE client at a time — if another app is
connected to the radio, this bot will not get a connection.