{"_id":"@autotic/n8n-nodes-uzapi","name":"@autotic/n8n-nodes-uzapi","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@autotic/n8n-nodes-uzapi","version":"0.1.0","description":"Uzapi Api","keywords":["n8n-community-node-package"],"license":"MIT","homepage":"https://github.com/Autotic/n8n-nodes-uzapi#readme","author":{"name":"autotic","email":"contato@autotic.com.br"},"repository":{"type":"git","url":"git+https://github.com/Autotic/n8n-nodes-uzapi.git"},"main":"index.js","scripts":{"build":"tsc && gulp build:icons","dev":"tsc --watch","format":"prettier nodes credentials --write","lint":"eslint nodes credentials package.json","lintfix":"eslint nodes credentials package.json --fix","prepublishOnly":"npm run build && npm run lint -c .eslintrc.prepublish.js nodes credentials package.json"},"n8n":{"n8nNodesApiVersion":1,"credentials":["dist/credentials/UZapiApi.credentials.js"],"nodes":["dist/nodes/UZapi/UZapi.node.js"],"utils":["dist/utils/files/fileUtils.js","dist/properties/options/options.js","dist/properties/properties.js"]},"devDependencies":{"@types/mime-types":"^2.1.4","@types/node":"^22.14.1","@types/qrcode":"^1.5.5","@types/ws":"^8.18.1","@typescript-eslint/parser":"~5.45","eslint-plugin-n8n-nodes-base":"^1.11.0","gulp":"^4.0.2","n8n-workflow":"*","prettier":"^2.7.1","typescript":"~4.8.4"},"peerDependencies":{"n8n-workflow":"*"},"dependencies":{"jimp":"^1.6.0","jsqr":"^1.4.0","pngjs":"^7.0.0","qrcode":"^1.5.4","qrcode-reader":"^1.0.4","sharp":"^0.34.1"},"_id":"@autotic/n8n-nodes-uzapi@0.1.0","gitHead":"bf60aee0187bdfa372a9324fb18dcc67be1f05b7","bugs":{"url":"https://github.com/Autotic/n8n-nodes-uzapi/issues"},"_nodeVersion":"22.8.0","_npmVersion":"10.8.2","dist":{"integrity":"sha512-jSZ+ulo6x9K/0q9iIMjlyRSgUd68nGW2mj5QnAT0YYViF2zTAQT8K3Zo8hJZ7XbIIoYR36iTEg9gTOHwi26NeQ==","shasum":"0a124c89ad417819055b0745e7a980c3aea79e3b","tarball":"https://registry.npmjs.org/@autotic/n8n-nodes-uzapi/-/n8n-nodes-uzapi-0.1.0.tgz","fileCount":62,"unpackedSize":134351,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDx+SXvChJMM8BIeTeFXMYZVGyWWiHzjKpaDMgcObaHAAIgCdJJUf3b5t3MkndrXQKOxc7peltnT0ej8P9WTrS7BNo="}]},"_npmUser":{"name":"autotic","email":"contato@autotic.com.br"},"directories":{},"maintainers":[{"name":"autotic","email":"contato@autotic.com.br"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/n8n-nodes-uzapi_0.1.0_1745023069925_0.8507955015310724"},"_hasShrinkwrap":false}},"time":{"created":"2025-04-19T00:37:49.829Z","0.1.0":"2025-04-19T00:37:50.143Z","modified":"2025-04-19T00:37:50.407Z"},"maintainers":[{"name":"autotic","email":"contato@autotic.com.br"}],"description":"Uzapi Api","homepage":"https://github.com/Autotic/n8n-nodes-uzapi#readme","keywords":["n8n-community-node-package"],"repository":{"type":"git","url":"git+https://github.com/Autotic/n8n-nodes-uzapi.git"},"author":{"name":"autotic","email":"contato@autotic.com.br"},"bugs":{"url":"https://github.com/Autotic/n8n-nodes-uzapi/issues"},"license":"MIT","readme":"# UZapi n8n Node\r\n\r\nCustom **n8n** node that integrates with the **UZapi** WhatsApp API, enabling you to start sessions, retrieve status, generate QR codes, and send different message types (text, media, files, Base64, etc.).\r\n\r\n---\r\n\r\n## Table of Contents\r\n\r\n1. [Features](#features)\r\n2. [Architecture](#architecture)\r\n3. [File Structure](#file-structure)\r\n4. [Prerequisites](#prerequisites)\r\n5. [Installation](#installation)\r\n6. [Credential Configuration](#credential-configuration)\r\n7. [Node Parameters](#node-parameters)\r\n8. [Supported Operations](#supported-operations)\r\n9. [Example Workflow](#example-workflow)\r\n10. [Development](#development)\r\n11. [Testing](#testing)\r\n12. [Contributing](#contributing)\r\n13. [License](#license)\r\n\r\n---\r\n\r\n## Features\r\n\r\n- **Start Session** – initialise a WhatsApp session in UZapi.\r\n- **Session Status** – query the current status of a session.\r\n- **Generate QR** – fetch & pad the QR code returned by the API.\r\n- **Send Messages** – text, link previews, images, videos, audio, generic files or Base64‑encoded files.\r\n- **Flexible Input** – choose between providing a URL, local path or binary input for *sendFile64*.\r\n- **Typed Codebase** – full TypeScript with strict typings for operations & properties.\r\n- **Modular Design** – helpers & operations separated for easy maintenance.\r\n\r\n---\r\n\r\n## Architecture\r\n\r\n```\r\nUZapi.node.ts          ← n8n Node wrapper (entry point)\r\n│\r\n├─ apiClient.ts        ← Thin HTTP wrapper using n8n helpers\r\n├─ operations/         ← One file per UZapi endpoint (startSession, sendText …)\r\n│   └─ index.ts        ← `operationsMap` exports all handlers\r\n├─ credentials/        ← Credential definition & helpers\r\n│\r\n├─ utils/\r\n│   ├─ properties/     ← Node parameter metadata (no code)\r\n│   └─ files/          ← Shared helpers (toDataUri, …)\r\n└─ UZapi.node.json     ← Codex metadata (categories, docs links)\r\n```\r\n\r\nThe node delegates every **operation** to an isolated handler in `operations/`.  Each handler receives the **context** (`IExecuteFunctions`), an **ApiClient** instance, and the **item index** – mirroring the functional style of native n8n nodes.\r\n\r\n---\r\n\r\n## File Structure\r\n\r\n| Path                                                   | Purpose                                                     |\r\n| ------------------------------------------------------ | ----------------------------------------------------------- |\r\n| `nodes/UZapi/UZapi.node.ts`                            | Main node class implementing `execute()`                    |\r\n| `nodes/UZapi/apiClient.ts`                             | Reusable wrapper around `helpers.requestWithAuthentication` |\r\n| `nodes/UZapi/operations/`                              | Endpoint handlers (pure functions)                          |\r\n| `nodes/UZapi/operations/index.ts`                      | `operationsMap` exports all handlers                        |\r\n| `nodes/UZapi/credentials/UZapiApi.credentials.ts`      | Credential type (base URL)                                  |\r\n| `nodes/UZapi/credentials/uzapiCredentialProperties.ts` | Typed credential fields & auth config                       |\r\n| `nodes/UZapi/utils/properties/`                        | Parameter metadata & option literals                        |\r\n| `nodes/UZapi/utils/files/fileUtils.ts`                 | Helper to convert local files → `data:` URIs                |\r\n| `nodes/UZapi/UZapi.node.json`                          | Codex definition (categories + docs)                        |\r\n\r\n---\r\n\r\n## Prerequisites\r\n\r\n- **n8n 1.45 +** (self‑hosted or desktop)\r\n- Valid **UZapi** account / API token (for protected endpoints)\r\n- Node .js ≥ 18 + Yarn/PNPM/NPM if you plan to build locally\r\n\r\n---\r\n\r\n## Installation\r\n\r\n1. Clone the repository into your `custom` directory:\r\n   ```bash\r\n   git clone https://github.com/your‑org/n8n‑uzapi‑node.git\r\n   cd n8n‑uzapi‑node\r\n   ```\r\n2. Install dependencies & build:\r\n   ```bash\r\n   npm install && npm run build\r\n   ```\r\n3. Restart n8n – the node **UZapi** should appear under *Miscellaneous*.\r\n\r\n---\r\n\r\n## Credential Configuration\r\n\r\n| Field        | Description                                                     |\r\n| ------------ | --------------------------------------------------------------- |\r\n| **Base URL** | Root URL of UZapi (default: `https://teste.uzapi.com.br:3333`). |\r\n\r\nAfter saving, reference this credential in your UZapi node instance; authentication headers will be injected automatically.\r\n\r\n---\r\n\r\n## Node Parameters\r\n\r\n| Parameter                        | Type      | Visibility            | Description                                                |\r\n| -------------------------------- | --------- | --------------------- | ---------------------------------------------------------- |\r\n| **Operation**                    | *options* | Always                | Which UZapi endpoint to call.                              |\r\n| **API Token**                    | *string*  | *startSession*        | Token for auth (if required by your plan).                 |\r\n| **Session Key**                  | *string*  | Most operations       | UUID provided during onboarding.                           |\r\n| **Session**                      | *string*  | Most operations       | Session ID returned by `/start`.                           |\r\n| **Número (com DDI)**             | *string*  | Message sends         | Destination in E.164 (e.g. `5511999998888`).               |\r\n| **Texto**                        | *string*  | *sendtext / sendLink* | Message body.                                              |\r\n| **URL**                          | *string*  | *sendLink*            | Link to preview.                                           |\r\n| **Descrição (caption)**          | *string*  | Media & files         | Caption for media / document.                              |\r\n| **Link (path)**                  | *string*  | Media (URL)           | Public URL or local path (will be sent as‑is).             |\r\n| **Arquivo (binaryPropertyName)** | *string*  | *sendFile64*          | If not set, the node falls back to the item’s binary data. |\r\n\r\n---\r\n\r\n## Supported Operations\r\n\r\n| Value          | Endpoint                     | Description                                                           |\r\n| -------------- | ---------------------------- | --------------------------------------------------------------------- |\r\n| `startSession` | **POST** `/start`            | Create / resume a session.                                            |\r\n| `getStatus`    | **POST** `/getSessionStatus` | Retrieve current session state.                                       |\r\n| `generateQr`   | **GET** `/getQrCode`         | Download QR (binary), add padding & output as binary field `qrImage`. |\r\n| `sendtext`     | **POST** `/sendText`         | Plain text message.                                                   |\r\n| `sendLink`     | **POST** `/sendLink`         | Text + url with preview.                                              |\r\n| `sendImage`    | **POST** `/sendImage`        | Image by URL/path with caption.                                       |\r\n| `sendFile`     | **POST** `/sendFile`         | Document by URL/path with caption.                                    |\r\n| `sendAudio`    | **POST** `/sendAudio`        | Audio file by URL/path with caption.                                  |\r\n| `sendVideo`    | **POST** `/sendVideo`        | Video file by URL/path with caption.                                  |\r\n| `sendFile64`   | **POST** `/sendFile64`       | File via data URI (handles binary → base64 automatically).            |\r\n\r\n---\r\n\r\nThe project uses **ESLint** with `@typescript-eslint`.  All source lives in `src/` and compiles to `dist/`.\r\n\r\n### Releasing a new version\r\n\r\n1. Bump `version` in `package.json`.\r\n2. Run `npm run build`.\r\n3. Publish the package or copy `dist/` into your n8n instance.\r\n\r\n---\r\n\r\n## Testing\r\n\r\nRight now the node is covered by **integration tests** that hit the UZapi sandbox.  Run them with:\r\n\r\n```bash\r\nnpm test\r\n```\r\n\r\n> **Note:** Provide environment variables `UZAPI_BASE_URL`, `UZAPI_SESSION_KEY`, `UZAPI_SESSION` etc. for the tests to interact with a real account.\r\n\r\n---\r\n\r\n## Contributing\r\n\r\nPull Requests are welcome!  Please open an issue first to discuss your feature or bug‑fix.  Make sure to:\r\n\r\n- Follow the existing code style (Prettier + ESLint).\r\n- Add / update tests.\r\n- Update this documentation if behaviour changes.\r\n\r\n---\r\n\r\n## License\r\n\r\nMIT © 2025 UZapi\r\n","readmeFilename":"README.md","_rev":"1-5c2af6a77e52cc948c1ebc64aeaedd66"}