Compare commits
6 Commits
fcc85101fd
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3b6c6fa914 | ||
|
|
120ab8f29a | ||
|
|
f551ee5618 | ||
|
|
ce2c8cb689 | ||
|
|
9b1b4b71bb | ||
|
|
87e77ced60 |
58
README.md
58
README.md
@@ -1,4 +1,58 @@
|
|||||||
|
# n8n Node: Wajs
|
||||||
|
|
||||||
# n8n-nodes-wajs
|
Ini adalah *community node* n8n untuk berinteraksi dengan layanan Wajs.
|
||||||
|
|
||||||
|
[](https://n8n.io)
|
||||||
|
[](https://www.npmjs.com/package/n8n-nodes-wajs)
|
||||||
|
[](https://spdx.org/licenses/MIT.html)
|
||||||
|
|
||||||
|
## Kompatibilitas n8n
|
||||||
|
|
||||||
|
Telah diuji dengan n8n versi `1.117.1` dan yang lebih baru.
|
||||||
|
|
||||||
|
## Instalasi
|
||||||
|
|
||||||
|
1. Buka n8n.
|
||||||
|
2. Pergi ke **Settings > Community Nodes**.
|
||||||
|
3. Pilih **Install**.
|
||||||
|
4. Masukkan `n8n-nodes-wajs` sebagai nama paket npm.
|
||||||
|
5. Klik **Install**.
|
||||||
|
|
||||||
|
Setelah instalasi selesai, node akan muncul di panel node Anda.
|
||||||
|
|
||||||
|
## Kredensial
|
||||||
|
|
||||||
|
Node ini memerlukan kredensial untuk terhubung ke Wajs.
|
||||||
|
|
||||||
|
1. Dari sidebar n8n, buka **Credentials > New**.
|
||||||
|
2. Cari **Wajs Credentials** dan pilih.
|
||||||
|
3. Isi informasi yang diperlukan untuk mengautentikasi akun Wajs Anda.
|
||||||
|
|
||||||
|
## Operasi
|
||||||
|
|
||||||
|
Node ini menyediakan operasi berikut:
|
||||||
|
* **Wajs**: Operasi utama untuk berinteraksi dengan API Wajs.
|
||||||
|
|
||||||
|
## Pengembangan (Development)
|
||||||
|
|
||||||
|
Berikut adalah cara untuk melakukan pengembangan pada node ini secara lokal.
|
||||||
|
|
||||||
|
### Prasyarat
|
||||||
|
- [Bun](https://bun.sh/) terinstal di sistem Anda.
|
||||||
|
- Lingkungan n8n untuk pengujian.
|
||||||
|
|
||||||
|
### Setup
|
||||||
|
1. Clone repositori ini.
|
||||||
|
2. Jalankan `bun install` untuk menginstal semua dependensi.
|
||||||
|
|
||||||
|
### Skrip yang Tersedia
|
||||||
|
|
||||||
|
- `bun run init`: Menginisialisasi proyek.
|
||||||
|
- `bun run build`: Mem-build node dari source code TypeScript.
|
||||||
|
- `bun run generate`: Men-generate file definisi node.
|
||||||
|
- `bun run version:update`: Memperbarui versi patch pada `package.json`.
|
||||||
|
- `bun run publish`: Menjalankan proses build, update versi, dan publikasi (memerlukan konfigurasi lebih lanjut).
|
||||||
|
|
||||||
|
## Lisensi
|
||||||
|
|
||||||
|
Dilisensikan di bawah [Lisensi MIT](LICENSE.md).
|
||||||
@@ -80,7 +80,8 @@ async function build() {
|
|||||||
|
|
||||||
console.log("🎉 Build complete!");
|
console.log("🎉 Build complete!");
|
||||||
}
|
}
|
||||||
|
const version = execSync('npm view lodash version').toString().trim();
|
||||||
execSync("cd src && npm version patch", { stdio: 'inherit' })
|
console.log("🚀 Version:", version);
|
||||||
|
execSync("cd src && npm version ", { stdio: 'inherit' })
|
||||||
build()
|
build()
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ async function loadOpenAPI(): Promise<OpenAPI> {
|
|||||||
|
|
||||||
// convert operation to value
|
// convert operation to value
|
||||||
function operationValue(tag: string, operationId: string) {
|
function operationValue(tag: string, operationId: string) {
|
||||||
return `${safe(tag)}_${safe(operationId)}`;
|
return _.snakeCase(`${tag}_${operationId}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// build properties for dropdown + dynamic inputs
|
// build properties for dropdown + dynamic inputs
|
||||||
@@ -55,7 +55,7 @@ function buildPropertiesBlock(ops: Array<any>) {
|
|||||||
options: [
|
options: [
|
||||||
${options.join(',\n ')}
|
${options.join(',\n ')}
|
||||||
],
|
],
|
||||||
default: '${operationValue(ops[0].tag, ops[0].operationId)}',
|
default: '${operationValue(ops[0].tag, ops[0].operationId).replace(/_/g, ' ')}',
|
||||||
description: 'Pilih endpoint yang akan dipanggil'
|
description: 'Pilih endpoint yang akan dipanggil'
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
@@ -75,7 +75,7 @@ function buildPropertiesBlock(ops: Array<any>) {
|
|||||||
default: '',
|
default: '',
|
||||||
placeholder: '${name}',
|
placeholder: '${name}',
|
||||||
description: '${name}',
|
description: '${name}',
|
||||||
displayOptions: { show: { operation: ['${value}'] } }
|
displayOptions: { show: { operation: ['${value}'] , "@tool": [true]} }
|
||||||
}`);
|
}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,7 +100,7 @@ function buildPropertiesBlock(ops: Array<any>) {
|
|||||||
default: ${defVal},
|
default: ${defVal},
|
||||||
placeholder: '${name}',
|
placeholder: '${name}',
|
||||||
description: '${schema?.description ?? name}',
|
description: '${schema?.description ?? name}',
|
||||||
displayOptions: { show: { operation: ['${value}'] } }
|
displayOptions: { show: { operation: ['${value}'], "@tool": [true] } }
|
||||||
}`);
|
}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -328,6 +328,10 @@ function packageText({ name, className }: { name: string, className: string }) {
|
|||||||
|
|
||||||
async function run() {
|
async function run() {
|
||||||
|
|
||||||
|
await fs.rm('src', { recursive: true }).catch(() => { })
|
||||||
|
await fs.mkdir('src/credentials', { recursive: true })
|
||||||
|
await fs.mkdir('src/nodes', { recursive: true })
|
||||||
|
|
||||||
console.log('💡 Loading OpenAPI...');
|
console.log('💡 Loading OpenAPI...');
|
||||||
const api = await loadOpenAPI();
|
const api = await loadOpenAPI();
|
||||||
|
|
||||||
|
|||||||
@@ -22,8 +22,14 @@ async function init() {
|
|||||||
throw new Error('NAMESPACE and OPENAPI_URL are required')
|
throw new Error('NAMESPACE and OPENAPI_URL are required')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await fs.rmdir("src", { recursive: true }).catch(() => { })
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await fs.access(".git")
|
await fs.access(".git")
|
||||||
|
|
||||||
|
console.log("[INIT] Git already initialized")
|
||||||
|
execSync("rm -rf .git")
|
||||||
|
execSync("git init")
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
execSync("git init")
|
execSync("git init")
|
||||||
}
|
}
|
||||||
@@ -49,7 +55,6 @@ async function init() {
|
|||||||
console.log('[INIT] Installing dependencies...');
|
console.log('[INIT] Installing dependencies...');
|
||||||
execSync("bun install", { stdio: 'inherit' })
|
execSync("bun install", { stdio: 'inherit' })
|
||||||
|
|
||||||
console.log('[INIT] Done');
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
27
bin/version_update.ts
Normal file
27
bin/version_update.ts
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
import { execSync } from "node:child_process";
|
||||||
|
import fs from "node:fs";
|
||||||
|
const NAMESPACE = process.env.NAMESPACE
|
||||||
|
|
||||||
|
if (!NAMESPACE) {
|
||||||
|
throw new Error('NAMESPACE is required')
|
||||||
|
}
|
||||||
|
|
||||||
|
// 1. Ambil versi remote dari npm
|
||||||
|
const remoteVersion = execSync(`npm view n8n-nodes-${NAMESPACE} version`)
|
||||||
|
.toString()
|
||||||
|
.trim();
|
||||||
|
|
||||||
|
console.log("🔍 Remote version:", remoteVersion);
|
||||||
|
|
||||||
|
// 2. Pecah versi → major.minor.patch
|
||||||
|
const [major, minor, patch] = remoteVersion.split(".").map(Number);
|
||||||
|
|
||||||
|
// 3. Generate versi baru: remote + 1 patch
|
||||||
|
const newLocalVersion = `${major}.${minor}.${patch + 1}`;
|
||||||
|
|
||||||
|
const pkgPath = "src/package.json";
|
||||||
|
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8"));
|
||||||
|
|
||||||
|
pkg.version = newLocalVersion;
|
||||||
|
|
||||||
|
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2));
|
||||||
@@ -5,9 +5,11 @@
|
|||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"init": "bun bin/init.ts",
|
"init": "bun bin/init.ts",
|
||||||
"generate": "bun bin/generate.ts",
|
|
||||||
"build": "bun bin/build.ts",
|
"build": "bun bin/build.ts",
|
||||||
"publish": "bun bin/publish.ts"
|
"generate": "bun bin/generate.ts",
|
||||||
|
"generate:build": "bun bin/generate.ts && bun bin/build.ts",
|
||||||
|
"version:update": "bun bin/version_update.ts",
|
||||||
|
"publish": "git add -A && git commit -m 'update version' && bun run version:update && bun run build && bun bin/publish.ts"
|
||||||
},
|
},
|
||||||
"dependencies": {},
|
"dependencies": {},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@@ -27,4 +29,4 @@
|
|||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"typescript": "^5"
|
"typescript": "^5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
103
src/README.md
103
src/README.md
@@ -1,86 +1,51 @@
|
|||||||
# n8n-nodes-wajs
|
# n8n-nodes-wajs
|
||||||
|
|
||||||
Node n8n kustom untuk berinteraksi dengan API wajs. Ini adalah node universal yang memungkinkan Anda mengakses berbagai endpoint API wajs untuk mengelola apikey, WhatsApp, webhook, chatflow, dan lainnya.
|
This is an n8n node to integrate with Wajs (WA-Resmi), allowing you to send various types of WhatsApp messages.
|
||||||
|
|
||||||
## Instalasi
|
Wajs is a service that provides a WhatsApp API. You can find more information and documentation at [https://wa-resmi.com](https://wa-resmi.com).
|
||||||
|
|
||||||
Untuk menginstal node ini di n8n Anda:
|
## Installation
|
||||||
|
|
||||||
1. Buka instalasi n8n Anda.
|
To use this node, you need to install it in your n8n setup.
|
||||||
2. Pergi ke **Settings > Community Nodes**.
|
|
||||||
3. Klik **Install a community node**.
|
|
||||||
4. Masukkan `n8n-nodes-wajs` dan klik **Install**.
|
|
||||||
|
|
||||||
n8n akan menginstal node, dan setelah itu Anda dapat menggunakannya dalam workflow Anda.
|
1. Go to **Settings > Community Nodes**.
|
||||||
|
2. Select **Install**.
|
||||||
|
3. Enter `n8n-nodes-wajs` as the npm package name.
|
||||||
|
4. Agree to the risks and click **Install**.
|
||||||
|
|
||||||
## Konfigurasi
|
n8n will restart, and the new node will be available in the editor.
|
||||||
|
|
||||||
Sebelum menggunakan node, Anda perlu mengkonfigurasi kredensial.
|
## Credentials
|
||||||
|
|
||||||
1. Di n8n, pergi ke **Credentials** dan klik **Add credential**.
|
To use this node, you need to configure your Wajs credentials.
|
||||||
2. Cari **wajs (Bearer Token)** dan pilih.
|
|
||||||
3. Isi detail berikut:
|
|
||||||
- **Base URL**: URL dasar API wajs Anda (misalnya, `https://api.example.com`).
|
|
||||||
- **Bearer Token**: Token API Anda.
|
|
||||||
|
|
||||||
## Operasi yang Tersedia
|
1. Go to the **Credentials** section in n8n.
|
||||||
|
2. Click **Add credential**.
|
||||||
|
3. Search for **Wajs** and select it.
|
||||||
|
4. Fill in the following fields:
|
||||||
|
* **API Key**: Your Wajs API Key.
|
||||||
|
* **Device Key**: Your Wajs Device Key.
|
||||||
|
5. Click **Save**.
|
||||||
|
|
||||||
Node ini menyediakan berbagai operasi yang dapat dipilih. Berikut adalah daftar operasi yang dikelompokkan berdasarkan kategori:
|
## Supported Operations
|
||||||
|
|
||||||
### API Key
|
This node supports the following operations for the `Message` resource:
|
||||||
|
|
||||||
- `apikey_postApiApikeyCreate`: Membuat API key baru.
|
* **Send Text**: Send a plain text message.
|
||||||
- `apikey_getApiApikeyList`: Mendapatkan daftar API key.
|
* **Send Media**: Send media files like images, videos, audio, or documents.
|
||||||
- `apikey_deleteApiApikeyDelete`: Menghapus API key.
|
* **Send Button**: Send a message with interactive buttons.
|
||||||
|
* **Send Template**: Send a pre-defined template message.
|
||||||
|
* **Send Location**: Send a map location.
|
||||||
|
* **Send Contact**: Send a contact card.
|
||||||
|
* **Send Reaction**: Send a reaction to a message.
|
||||||
|
* **Forward Message**: Forward an existing message.
|
||||||
|
* **Check Number**: Check if a phone number is valid and has a WhatsApp account.
|
||||||
|
|
||||||
### WhatsApp
|
## Author
|
||||||
|
|
||||||
- `WhatsApp_postApiWaStart`: Memulai sesi WhatsApp.
|
* **Name**: makuro
|
||||||
- `WhatsApp_getApiWaQr`: Mendapatkan kode QR untuk login.
|
* **Phone**: 6289697338821
|
||||||
- `WhatsApp_getApiWaReady`: Memeriksa apakah sesi siap.
|
|
||||||
- `WhatsApp_postApiWaRestart`: Memulai ulang sesi.
|
|
||||||
- `WhatsApp_postApiWaForce_start`: Memaksa memulai sesi.
|
|
||||||
- `WhatsApp_postApiWaStop`: Menghentikan sesi.
|
|
||||||
- `WhatsApp_getApiWaState`: Mendapatkan status sesi.
|
|
||||||
- `WhatsApp_postApiWaSend_text`: Mengirim pesan teks.
|
|
||||||
- `WhatsApp_postApiWaSend_media`: Mengirim pesan media.
|
|
||||||
|
|
||||||
### Webhook
|
## License
|
||||||
|
|
||||||
- `Webhook_postApiWebhookCreate`: Membuat webhook.
|
ISC
|
||||||
- `Webhook_getApiWebhookList`: Mendapatkan daftar webhook.
|
|
||||||
- `Webhook_getApiWebhookFindById`: Mencari webhook berdasarkan ID.
|
|
||||||
- `Webhook_deleteApiWebhookRemoveById`: Menghapus webhook berdasarkan ID.
|
|
||||||
- `Webhook_putApiWebhookUpdateById`: Memperbarui webhook berdasarkan ID.
|
|
||||||
|
|
||||||
### Chatflows
|
|
||||||
|
|
||||||
- `chatflows_getApiChatflowsSync`: Sinkronisasi chatflow.
|
|
||||||
- `chatflows_getApiChatflowsFind`: Mencari chatflow.
|
|
||||||
- `chatflows_getApiChatflowsDefault`: Mendapatkan chatflow default.
|
|
||||||
- `chatflows_putApiChatflowsDefault`: Mengatur chatflow default.
|
|
||||||
- `chatflows_postApiChatflowsQuery`: Mengirim query ke chatflow.
|
|
||||||
- `chatflows_putApiChatflowsFlow_active`: Mengaktifkan/menonaktifkan flow.
|
|
||||||
- `chatflows_getApiChatflowsUrl_token`: Mendapatkan URL dan token flow.
|
|
||||||
- `chatflows_putApiChatflowsUrl_token`: Memperbarui URL dan token flow.
|
|
||||||
|
|
||||||
### Autentikasi
|
|
||||||
|
|
||||||
- `auth_postAuthLogin`: Login ke akun.
|
|
||||||
- `auth_deleteAuthLogout`: Logout dari akun.
|
|
||||||
|
|
||||||
### WhatsApp Hook
|
|
||||||
|
|
||||||
- `WhatsApp_Hook_getWa_hookHook`: Verifikasi webhook.
|
|
||||||
- `WhatsApp_Hook_postWa_hookHook`: Menerima pesan WhatsApp.
|
|
||||||
- `WhatsApp_Hook_getWa_hookList`: Mendapatkan daftar hook.
|
|
||||||
- `WhatsApp_Hook_postWa_hookReset`: Mereset hook.
|
|
||||||
|
|
||||||
### Logs
|
|
||||||
|
|
||||||
- `logs_getLogsShow`: Menampilkan log.
|
|
||||||
- `logs_postLogsClear`: Membersihkan log.
|
|
||||||
|
|
||||||
## Lisensi
|
|
||||||
|
|
||||||
[ISC](LICENSE)
|
|
||||||
|
|||||||
28
src/credentials/WajsCredentials.credentials.ts
Normal file
28
src/credentials/WajsCredentials.credentials.ts
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
import { ICredentialType, INodeProperties } from "n8n-workflow";
|
||||||
|
|
||||||
|
export class WajsCredentials implements ICredentialType {
|
||||||
|
name = "wajs";
|
||||||
|
displayName = "wajs (Bearer Token)";
|
||||||
|
|
||||||
|
properties: INodeProperties[] = [
|
||||||
|
{
|
||||||
|
displayName: "Base URL",
|
||||||
|
name: "baseUrl",
|
||||||
|
type: "string",
|
||||||
|
default: "",
|
||||||
|
placeholder: "https://api.example.com",
|
||||||
|
description: "Masukkan URL dasar API tanpa garis miring di akhir",
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: "Bearer Token",
|
||||||
|
name: "token",
|
||||||
|
type: "string",
|
||||||
|
default: "",
|
||||||
|
typeOptions: { password: true },
|
||||||
|
description:
|
||||||
|
"Masukkan token autentikasi Bearer (tanpa 'Bearer ' di depannya)",
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
1564
src/nodes/Wajs.node.ts
Normal file
1564
src/nodes/Wajs.node.ts
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "n8n-nodes-wajs",
|
"name": "n8n-nodes-wajs",
|
||||||
"version": "1.1.10",
|
"version": "1.1.14",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"n8n",
|
"n8n",
|
||||||
"n8n-nodes"
|
"n8n-nodes"
|
||||||
@@ -20,4 +20,4 @@
|
|||||||
"credentials/WajsCredentials.credentials.js"
|
"credentials/WajsCredentials.credentials.js"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user