{"id":34896425,"url":"https://github.com/fajar-dev/buku-flow","last_synced_at":"2026-05-22T00:38:03.030Z","repository":{"id":326825460,"uuid":"1106904194","full_name":"fajar-dev/buku-flow","owner":"fajar-dev","description":"whatsapp flow untuk peminjaman buku","archived":false,"fork":false,"pushed_at":"2025-12-18T09:21:52.000Z","size":66,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-12-21T16:35:03.087Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fajar-dev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-30T07:18:11.000Z","updated_at":"2025-12-18T09:21:55.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/fajar-dev/buku-flow","commit_stats":null,"previous_names":["fajar-dev/buku-flow"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/fajar-dev/buku-flow","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fajar-dev%2Fbuku-flow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fajar-dev%2Fbuku-flow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fajar-dev%2Fbuku-flow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fajar-dev%2Fbuku-flow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fajar-dev","download_url":"https://codeload.github.com/fajar-dev/buku-flow/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fajar-dev%2Fbuku-flow/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28048023,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-26T02:00:06.189Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-12-26T07:03:45.187Z","updated_at":"2025-12-26T07:05:06.475Z","avatar_url":"https://github.com/fajar-dev.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Buku Flow\n\n\n## 📦 Installation\n\n### Prerequisites\n\n- [Bun](https://bun.sh) v1.0 or higher\n- MySQL Server\n- WhatsApp Business API access\n\n### Installation Steps\n\n1. Clone repository:\n```bash\ngit clone \u003crepository-url\u003e\ncd buku-flow\n```\n\n2. Install dependencies:\n```bash\nbun install\n```\n\n3. Setup environment variables:\n```bash\ncp .env.dist .env\n```\n\n4. Edit the `.env` file with your configuration:\n```env\nPORT=3000\n\n# SIMAS Database (Employee \u0026 Asset Data)\nSIMAS_DB_HOST=localhost\nSIMAS_DB_PORT=3306\nSIMAS_DB_USER=root\nSIMAS_DB_PASSWORD=your_password\nSIMAS_DB_NAME=simas_db\n\n# Flow Database (Flow Management)\nFLOW_DB_HOST=localhost\nFLOW_DB_PORT=3306\nFLOW_DB_USER=root\nFLOW_DB_PASSWORD=your_password\nFLOW_DB_NAME=flow_db\n\n# WhatsApp Business API\nWHATSAPP_API_KEY=your_api_key\nWHATSAPP_API_URL=https://graph.facebook.com\nWHATSAPP_API_VERSION=v18.0\nWHATSAPP_API_PHONE_ID=your_phone_id\n\n# Security\nNUSANET_APP_SECRET=your_app_secret\nNUSAFIBER_APP_SECRET=your_app_secret\nPASSPHRASE=your_passphrase\nPRIVATE_KEY=your_private_key\n```\n\n5. Generate private key (if not already exists):\n```bash\nbun run src/keyGenerator.ts \u003cpassphrase\u003e\n```\n\n## 🔐 Generate Key Pair\n\nTo generate a new RSA key pair for WhatsApp Flow encryption:\n\n1. Run the key generator:\n```bash\nbun run src/keyGenerator.ts  \u003cpassphrase\u003e\n```\n\n2. The script will output:\n   - **PASSPHRASE**: Copy this value to your `.env` file\n   - **PRIVATE_KEY**: Copy the entire key (including `-----BEGIN RSA PRIVATE KEY-----` and `-----END RSA PRIVATE KEY-----`) to your `.env` file\n   - **PUBLIC_KEY**: Upload this key to your WhatsApp Business Manager\n\n3. Update your `.env` file with the generated values:\n```env\nPASSPHRASE=\"your_generated_passphrase\"\nPRIVATE_KEY=\"-----BEGIN RSA PRIVATE KEY-----\n...your_private_key_content...\n-----END RSA PRIVATE KEY-----\"\n```\n\n4. Upload the **PUBLIC KEY** to WhatsApp Business Manager:\n   - Go to WhatsApp Business Manager → Settings → WhatsApp Flows\n   - Select your flow → Settings → Encryption\n   - Paste the public key and save\n\n### Upload Public Key via API\n\nYou can also upload the public key using the WhatsApp Business API:\n\n```bash\ncurl -X POST \\\n  'https://graph.facebook.com/v24.0/PHONE_NUMBER_ID/whatsapp_business_encryption' \\\n  -H 'Authorization: Bearer ACCESS_TOKEN' \\\n  -H 'Content-Type: application/x-www-form-urlencoded' \\\n  --data-urlencode 'business_public_key=-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA...\n...your_public_key_content...\n-----END PUBLIC KEY-----'\n```\n\nReplace:\n- `PHONE_NUMBER_ID`: Your WhatsApp Business phone number ID\n- `ACCESS_TOKEN`: Your WhatsApp Business API access token\n\n\n## 🚀 Running the Application\n\n### Development Mode\n```bash\nbun run dev\n```\n\n### Build\n```bash\nbun run build\n```\n\n### Running Reminder Cron Job\n```bash\nbun run reminder\n```\n\n## 📁 Project Structure\n\n```\nbuku-flow/\n├── src/\n│   ├── config/\n│   │   ├── config.ts          # Environment configuration\n│   │   ├── flow.db.ts         # Flow database connection\n│   │   └── simas.db.ts        # SIMAS database connection\n│   ├── flow/\n│   │   ├── assigned.flow.ts   # Assignment flow logic\n│   │   └── returned.flow.ts   # Return flow logic\n│   ├── service/\n│   │   ├── reminder.service.ts    # Reminder service\n│   │   ├── simas.service.ts       # SIMAS data service\n│   │   └── whatsapp.service.ts    # WhatsApp API service\n│   ├── encryption.ts          # Encryption/decryption utility\n│   ├── keyGenerator.ts        # Private key generator\n│   ├── main.ts               # Application entry point\n│   └── reminder.cron.ts      # Reminder cron job\n├── .env.dist                 # Environment variables template\n├── .gitignore\n├── package.json\n├── tsconfig.json\n└── README.md\n```\n\n## 🔌 API Endpoints\n\n### `POST /assigned`\nEndpoint for WhatsApp Flow book assignment.\n\n**Headers:**\n- `x-hub-signature-256`: Signature for request validation\n\n**Body:**\n```json\n{\n  \"encrypted_aes_key\": \"...\",\n  \"encrypted_flow_data\": \"...\",\n  \"initial_vector\": \"...\"\n}\n```\n\n### `POST /returned`\nEndpoint for WhatsApp Flow book return.\n\n**Headers:**\n- `x-hub-signature-256`: Signature for request validation\n\n**Body:**\n```json\n{\n  \"encrypted_aes_key\": \"...\",\n  \"encrypted_flow_data\": \"...\",\n  \"initial_vector\": \"...\"\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffajar-dev%2Fbuku-flow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffajar-dev%2Fbuku-flow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffajar-dev%2Fbuku-flow/lists"}