mqtt
Some checks failed
CI / Test (1.22) (push) Failing after -23m51s
CI / Test (1.23) (push) Failing after -23m51s
CI / Lint (push) Has been cancelled
CI / Build (push) Has been cancelled
Release / Build and Release (push) Successful in -18m25s

This commit is contained in:
2025-12-29 23:36:22 +02:00
parent fd2527219e
commit ea1209c84c
14 changed files with 864 additions and 46 deletions

View File

@@ -176,6 +176,92 @@ You can also use the CLI tool outside Docker to link accounts, then mount the se
./bin/whatshook-cli accounts add
```
## Using the CLI Inside Docker
The Docker image includes both the server and CLI binaries in the `/app/bin` directory. You can use the CLI to manage hooks and accounts while the server is running.
### Available CLI Commands
List all hooks:
```bash
docker exec whatshooked-server /app/bin/whatshook-cli --server http://localhost:8080 hooks list
```
Add a new hook:
```bash
docker exec -it whatshooked-server /app/bin/whatshook-cli --server http://localhost:8080 hooks add
```
Remove a hook:
```bash
docker exec whatshooked-server /app/bin/whatshook-cli --server http://localhost:8080 hooks remove <hook_id>
```
List WhatsApp accounts:
```bash
docker exec whatshooked-server /app/bin/whatshook-cli --server http://localhost:8080 accounts list
```
Send a message:
```bash
docker exec -it whatshooked-server /app/bin/whatshook-cli --server http://localhost:8080 send
```
Check server health:
```bash
docker exec whatshooked-server /app/bin/whatshook-cli --server http://localhost:8080 health
```
### Authentication with CLI
If your server has authentication enabled, you need to configure it in the CLI:
**Option 1: Using command-line flags**
```bash
docker exec whatshooked-server /app/bin/whatshook-cli \
--server http://localhost:8080 \
--api-key your-api-key \
hooks list
```
**Option 2: Create a CLI config file**
1. Access the container:
```bash
docker exec -it whatshooked-server sh
```
2. Create the CLI config:
```bash
cat > /app/.whatshooked-cli.json <<EOF
{
"server_url": "http://localhost:8080",
"api_key": "your-api-key"
}
EOF
```
3. Exit and use CLI without flags:
```bash
docker exec whatshooked-server /app/bin/whatshook-cli hooks list
```
### Shell Alias for Convenience
Create an alias on your host machine for easier CLI access:
```bash
alias whatshook-cli='docker exec -it whatshooked-server /app/bin/whatshook-cli --server http://localhost:8080'
```
Then use it like:
```bash
whatshook-cli hooks list
whatshook-cli send
```
Add this to your `~/.bashrc` or `~/.zshrc` to make it permanent.
## Troubleshooting
### Container won't start