npm package: @migastonesrl/n8n-nodes-migasender
Description: Production-ready n8n community node package for MIGASENDER messaging and log retrieval.
Author: Migastone
Latest version: 0.4.2

# n8n-nodes-migasender

`n8n-nodes-migasender` is a production-ready n8n community node package for integrating with MIGASENDER. It provides:

- `MIGASENDER` action node
- `MIGASENDER Trigger` webhook trigger node

The action node replicates the existing Make.com integration flow for sending messages and retrieving chat logs from MIGASENDER endpoints.

## Features

### MIGASENDER

- Resource: `Message`
- Operation: `Send Message`
- Sends `application/x-www-form-urlencoded` payloads to:
  - `/migawhatsapp/api_send/message`

- Resource: `Logs`
- Operation: `Retrieve Logs`
- Retrieves logs from:
  - `/migawhatsapp/api_chathistory/history`

### MIGASENDER Trigger

- Webhook-style trigger node
- Accepts inbound `POST` events
- Supports filtering for:
  - `New Message Received`

## Installation

### Install from the n8n UI

Self-hosted n8n only:

1. Go to `Settings > Community Nodes`.
2. Select `Install`.
3. Enter `n8n-nodes-migasender`.
4. Confirm the installation and restart n8n if required.

### Install manually with npm

For manual self-hosted installation, install the package in `~/.n8n/nodes`:

```bash
mkdir -p ~/.n8n/nodes
cd ~/.n8n/nodes
npm install n8n-nodes-migasender
```

Restart n8n after installation.

## Configure credentials

Create a `MIGASENDER API` credential and provide:

- `Base URL`
  - Default: `https://beta.migastone.com`
- `Security Token`
- `App ID`
- `Line ID`
  - Default: `1`

The credential test calls:

- `GET /migawhatsapp/api_send/heartbeat`

with:

- `security_token`
- `app_id`
- `line_id`

## Send Message example

Use the `MIGASENDER` node with:

- Resource: `Message`
- Operation: `Send Message`

Example parameters:

```json
{
  "message": "Hello from n8n",
  "phone": "923001234567",
  "email": "ali@example.com",
  "name": "Ali",
  "surname": "Khan"
}
```

The node sends a form-urlencoded request and automatically omits empty optional fields.

## Retrieve Logs example

Use the `MIGASENDER` node with:

- Resource: `Logs`
- Operation: `Retrieve Logs`

Default request behavior:

- `filter_start_date`: now minus 24 hours
- `filter_start_time`: now minus 24 hours
- `draw`: `1`
- `start`: `0`
- `length`: `10`

If the MIGASENDER response contains arrays under `data`, `rows`, `items`, or `results`, the node emits one n8n item per entry.

## Trigger node example

Use `MIGASENDER Trigger` when MIGASENDER or an intermediate webhook sender can post inbound event payloads to n8n.

1. Add `MIGASENDER Trigger` to a workflow.
2. Copy the generated webhook URL.
3. Configure the sender to issue `POST` requests to that URL.
4. Optionally filter for:
   - `New Message Received`

The trigger emits items in this structure:

```json
{
  "eventType": "newMessageReceived",
  "payload": {
    "message": "Inbound message"
  },
  "headers": {},
  "query": {},
  "receivedAt": "2026-03-09T00:00:00.000Z"
}
```

## Development commands

```bash
npm install
npm run build
npm run lint
npm run lint:fix
npm run dev
```

## npm publish instructions

1. Update the version in `package.json`.
2. Build the package:

```bash
npm run build
```

3. Log in to npm:

```bash
npm login
```

4. Publish the package:

```bash
npm publish --access public
```

## Notes

- The node formats API errors as:
  - `[statusCode] error error_code`
- The security token is never included in error messages.
- This package is intended for self-hosted n8n community-node installation and npm publication.