new feat: gateway dipakai bersama dengan send-wa-kwitansi
including:
- remove batch_size di config-gw-wa.json
- merge function, bedakan dengan message_type
This commit is contained in:
61
README.md
61
README.md
@@ -1,39 +1,62 @@
|
||||
Sample config file
|
||||
# WhatsApp Gateway Service
|
||||
A lightweight service for sending WhatsApp messages with PDF attachments through Qontak API. Supports multiple message types and provides automatic retries for failed messages.
|
||||
|
||||
## Configuration
|
||||
Create a `config-gw-wa.json` file in the root directory:
|
||||
```json
|
||||
{
|
||||
"base_url": "https://cpone.aplikasi.web.id/one-api/",
|
||||
// Setiap 2 menit dari jam 6 sampai 20
|
||||
"schedule": [
|
||||
"*/2 6-20 * * *"
|
||||
"*/2 6-20 * * *" // Runs every 2 minutes from 6 AM to 8 PM
|
||||
],
|
||||
"delay": 5,
|
||||
"row_per_batch": 50,
|
||||
"startDate": "2023-08-01", //yyyy-mm-dd tanggal data dicari dimulai
|
||||
"endDate": "2025-12-30", //yyyy-mm-dd tanggal data dicari berakhir
|
||||
"startDate": "2023-08-01", // Filter T_OrderHeaderDate from this date (YYYY-MM-DD)
|
||||
"endDate": "2025-12-30" // Filter T_OrderHeaderDate until this date (YYYY-MM-DD)
|
||||
}
|
||||
```
|
||||
|
||||
Install Dependencies
|
||||
## Supported Message Types
|
||||
* MCU Result: Medical checkup results with PDF attachment
|
||||
* Payment Receipt: Payment receipts with PDF attachment
|
||||
|
||||
## Installation
|
||||
```bash
|
||||
# Install dependencies
|
||||
npm install
|
||||
|
||||
# Format code
|
||||
npm run format
|
||||
```
|
||||
|
||||
Build the source
|
||||
## Build & Run
|
||||
```bash
|
||||
# Build TypeScript source
|
||||
npm run build
|
||||
```
|
||||
|
||||
Compile
|
||||
```bash
|
||||
npm run compile
|
||||
```
|
||||
# Compile to executable
|
||||
npm run compile
|
||||
|
||||
Run
|
||||
```bash
|
||||
# Run the application
|
||||
npm run start
|
||||
|
||||
# Or build, compile and start in one command
|
||||
npm run bcs
|
||||
```
|
||||
|
||||
Run Script
|
||||
## Run Compiled File
|
||||
```sh
|
||||
# Dijalankan di lokasi yang sama dengan `config-gw-wa.json`
|
||||
node ./dist/gw-wa.js
|
||||
```
|
||||
node .\dist\gw-wa.js
|
||||
```
|
||||
|
||||
## Development Notes
|
||||
The gateway checks for outbox items with status:
|
||||
|
||||
* N: New messages
|
||||
* E: Error messages (with retry logic, max 5 attempts)
|
||||
* R: Rejected messages
|
||||
|
||||
Each message type uses its own API endpoints for:
|
||||
* listing,
|
||||
* uploading files,
|
||||
* sending messages,
|
||||
* then updating status.
|
||||
Reference in New Issue
Block a user