Refactor port again
This commit is contained in:
40
README.md
40
README.md
@@ -60,7 +60,7 @@ Or with programmatic configuration:
|
||||
|
||||
```go
|
||||
wh, err := whatshooked.New(
|
||||
whatshooked.WithServer("0.0.0.0", 8025),
|
||||
whatshooked.WithServer("0.0.0.0", 8825),
|
||||
whatshooked.WithAuth("my-api-key", "", ""),
|
||||
whatshooked.WithWhatsmeowAccount("personal", "+1234567890", "./session", true),
|
||||
)
|
||||
@@ -92,7 +92,7 @@ Scan this QR code with WhatsApp on your phone:
|
||||
|
||||
[ASCII QR Code displayed here]
|
||||
|
||||
Or open in browser: http://localhost:8025/api/qr/personal
|
||||
Or open in browser: http://localhost:8825/api/qr/personal
|
||||
========================================
|
||||
```
|
||||
|
||||
@@ -100,7 +100,7 @@ Or open in browser: http://localhost:8025/api/qr/personal
|
||||
|
||||
For easier scanning, open the provided URL in your browser to view a larger PNG image:
|
||||
|
||||
- URL format: `http://localhost:8025/api/qr/{account_id}`
|
||||
- URL format: `http://localhost:8825/api/qr/{account_id}`
|
||||
- No authentication required for this endpoint
|
||||
- The QR code updates automatically when a new code is generated
|
||||
|
||||
@@ -114,7 +114,7 @@ The QR code URL is also included in the `whatsapp.qr.code` event:
|
||||
"data": {
|
||||
"account_id": "personal",
|
||||
"qr_code": "2@...",
|
||||
"qr_url": "http://localhost:8025/api/qr/personal"
|
||||
"qr_url": "http://localhost:8825/api/qr/personal"
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -210,7 +210,7 @@ func main() {
|
||||
// Your own handlers
|
||||
mux.HandleFunc("/api/v1/custom", yourCustomHandler)
|
||||
|
||||
http.ListenAndServe(":8025", mux)
|
||||
http.ListenAndServe(":8825", mux)
|
||||
}
|
||||
```
|
||||
|
||||
@@ -220,7 +220,7 @@ Configure WhatsHooked entirely in code without a config file:
|
||||
|
||||
```go
|
||||
wh, err := whatshooked.New(
|
||||
whatshooked.WithServer("0.0.0.0", 8025),
|
||||
whatshooked.WithServer("0.0.0.0", 8825),
|
||||
whatshooked.WithAuth("my-api-key", "", ""),
|
||||
whatshooked.WithWhatsmeowAccount(
|
||||
"personal",
|
||||
@@ -389,7 +389,7 @@ Edit the configuration file to add your WhatsApp accounts and webhooks:
|
||||
{
|
||||
"server": {
|
||||
"host": "localhost",
|
||||
"port": 8025,
|
||||
"port": 8825,
|
||||
"default_country_code": "27"
|
||||
},
|
||||
"whatsapp": [
|
||||
@@ -435,7 +435,7 @@ Edit the configuration file to add your WhatsApp accounts and webhooks:
|
||||
**Server Configuration:**
|
||||
|
||||
- `host`: Server hostname (default: "localhost")
|
||||
- `port`: Server port (default: 8025)
|
||||
- `port`: Server port (default: 8825)
|
||||
- `default_country_code`: Default country code for phone number formatting (e.g., "27" for South Africa, "1" for US/Canada)
|
||||
- `username`: Username for HTTP Basic Authentication (optional)
|
||||
- `password`: Password for HTTP Basic Authentication (optional)
|
||||
@@ -637,7 +637,7 @@ To disable HTTPS and use HTTP, set `enabled: false` or omit the `tls` section en
|
||||
{
|
||||
"server": {
|
||||
"host": "localhost",
|
||||
"port": 8025
|
||||
"port": 8825
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -654,7 +654,7 @@ Set both `username` and `password` in the server configuration:
|
||||
{
|
||||
"server": {
|
||||
"host": "localhost",
|
||||
"port": 8025,
|
||||
"port": 8825,
|
||||
"username": "admin",
|
||||
"password": "secure_password"
|
||||
}
|
||||
@@ -664,7 +664,7 @@ Set both `username` and `password` in the server configuration:
|
||||
Clients must provide credentials in the Authorization header:
|
||||
|
||||
```bash
|
||||
curl -u admin:secure_password http://localhost:8025/api/hooks
|
||||
curl -u admin:secure_password http://localhost:8825/api/hooks
|
||||
```
|
||||
|
||||
#### 2. API Key Authentication
|
||||
@@ -675,7 +675,7 @@ Set `auth_key` in the server configuration:
|
||||
{
|
||||
"server": {
|
||||
"host": "localhost",
|
||||
"port": 8025,
|
||||
"port": 8825,
|
||||
"auth_key": "your-secret-api-key"
|
||||
}
|
||||
}
|
||||
@@ -685,11 +685,11 @@ Clients can provide the API key using either:
|
||||
|
||||
- **x-api-key header**:
|
||||
```bash
|
||||
curl -H "x-api-key: your-secret-api-key" http://localhost:8025/api/hooks
|
||||
curl -H "x-api-key: your-secret-api-key" http://localhost:8825/api/hooks
|
||||
```
|
||||
- **Authorization Bearer token**:
|
||||
```bash
|
||||
curl -H "Authorization: Bearer your-secret-api-key" http://localhost:8025/api/hooks
|
||||
curl -H "Authorization: Bearer your-secret-api-key" http://localhost:8825/api/hooks
|
||||
```
|
||||
|
||||
#### Authentication Notes
|
||||
@@ -755,7 +755,7 @@ To receive incoming messages from WhatsApp Business API, you must register your
|
||||
1. **Start the WhatsHooked server** with your Business API configuration
|
||||
2. **Ensure your server is publicly accessible** (use ngrok for testing):
|
||||
```bash
|
||||
ngrok http 8025
|
||||
ngrok http 8825
|
||||
```
|
||||
3. **In Meta for Developers**, go to **WhatsApp** → **Configuration**
|
||||
4. **Add Webhook URL**:
|
||||
@@ -895,13 +895,13 @@ cp .whatshooked-cli.example.json .whatshooked-cli.json
|
||||
Or set via environment variable:
|
||||
|
||||
```bash
|
||||
export WHATSHOOKED_SERVER_URL=http://localhost:8025
|
||||
export WHATSHOOKED_SERVER_URL=http://localhost:8825
|
||||
```
|
||||
|
||||
Or use command-line flag:
|
||||
|
||||
```bash
|
||||
./bin/whatshook-cli --server http://localhost:8025 health
|
||||
./bin/whatshook-cli --server http://localhost:8825 health
|
||||
```
|
||||
|
||||
#### Commands
|
||||
@@ -963,10 +963,10 @@ Send a message:
|
||||
|
||||
The CLI loads configuration with the following priority (highest to lowest):
|
||||
|
||||
1. **Command-line flags**: `--server http://example.com:8025`
|
||||
2. **Environment variables**: `WHATSHOOKED_SERVER_URL=http://example.com:8025`
|
||||
1. **Command-line flags**: `--server http://example.com:8825`
|
||||
2. **Environment variables**: `WHATSHOOKED_SERVER_URL=http://example.com:8825`
|
||||
3. **Config file**: `.whatshooked-cli.json` in current directory or `$HOME/.whatshooked/cli.json`
|
||||
4. **Defaults**: `http://localhost:8025`
|
||||
4. **Defaults**: `http://localhost:8825`
|
||||
|
||||
## Webhook Integration
|
||||
|
||||
|
||||
Reference in New Issue
Block a user