Compare commits
4 Commits
fcc85101fd
...
f551ee5618
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f551ee5618 | ||
|
|
ce2c8cb689 | ||
|
|
9b1b4b71bb | ||
|
|
87e77ced60 |
@@ -80,7 +80,8 @@ async function build() {
|
||||
|
||||
console.log("🎉 Build complete!");
|
||||
}
|
||||
|
||||
execSync("cd src && npm version patch", { stdio: 'inherit' })
|
||||
const version = execSync('npm view lodash version').toString().trim();
|
||||
console.log("🚀 Version:", version);
|
||||
execSync("cd src && npm version ", { stdio: 'inherit' })
|
||||
build()
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ async function loadOpenAPI(): Promise<OpenAPI> {
|
||||
|
||||
// convert operation to value
|
||||
function operationValue(tag: string, operationId: string) {
|
||||
return `${safe(tag)}_${safe(operationId)}`;
|
||||
return _.snakeCase(`${tag}_${operationId}`);
|
||||
}
|
||||
|
||||
// build properties for dropdown + dynamic inputs
|
||||
@@ -55,7 +55,7 @@ function buildPropertiesBlock(ops: Array<any>) {
|
||||
options: [
|
||||
${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'
|
||||
}
|
||||
`;
|
||||
@@ -75,7 +75,7 @@ function buildPropertiesBlock(ops: Array<any>) {
|
||||
default: '',
|
||||
placeholder: '${name}',
|
||||
description: '${name}',
|
||||
displayOptions: { show: { operation: ['${value}'] } }
|
||||
displayOptions: { show: { operation: ['${value}'] , "@tool": [true]} }
|
||||
}`);
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ function buildPropertiesBlock(ops: Array<any>) {
|
||||
default: ${defVal},
|
||||
placeholder: '${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() {
|
||||
|
||||
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...');
|
||||
const api = await loadOpenAPI();
|
||||
|
||||
|
||||
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",
|
||||
"scripts": {
|
||||
"init": "bun bin/init.ts",
|
||||
"generate": "bun bin/generate.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": {},
|
||||
"devDependencies": {
|
||||
@@ -27,4 +29,4 @@
|
||||
"peerDependencies": {
|
||||
"typescript": "^5"
|
||||
}
|
||||
}
|
||||
}
|
||||
103
src/README.md
103
src/README.md
@@ -1,86 +1,51 @@
|
||||
# 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.
|
||||
2. Pergi ke **Settings > Community Nodes**.
|
||||
3. Klik **Install a community node**.
|
||||
4. Masukkan `n8n-nodes-wajs` dan klik **Install**.
|
||||
To use this node, you need to install it in your n8n setup.
|
||||
|
||||
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**.
|
||||
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.
|
||||
To use this node, you need to configure your Wajs credentials.
|
||||
|
||||
## 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.
|
||||
- `apikey_getApiApikeyList`: Mendapatkan daftar API key.
|
||||
- `apikey_deleteApiApikeyDelete`: Menghapus API key.
|
||||
* **Send Text**: Send a plain text message.
|
||||
* **Send Media**: Send media files like images, videos, audio, or documents.
|
||||
* **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.
|
||||
- `WhatsApp_getApiWaQr`: Mendapatkan kode QR untuk login.
|
||||
- `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.
|
||||
* **Name**: makuro
|
||||
* **Phone**: 6289697338821
|
||||
|
||||
### Webhook
|
||||
## License
|
||||
|
||||
- `Webhook_postApiWebhookCreate`: Membuat webhook.
|
||||
- `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)
|
||||
ISC
|
||||
|
||||
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",
|
||||
"version": "1.1.10",
|
||||
"version": "1.1.13",
|
||||
"keywords": [
|
||||
"n8n",
|
||||
"n8n-nodes"
|
||||
@@ -20,4 +20,4 @@
|
||||
"credentials/WajsCredentials.credentials.js"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user