npm package: @martianatwork/n8n-nodes-aisensy
Description: n8n custom node for AiSensy WhatsApp API integration - fetch campaigns and send messages
Author: Bhavesh
Latest version: 0.1.13

# n8n-nodes-aisensy

This is an n8n community node that lets you use AiSensy WhatsApp API in your n8n workflows.

AiSensy is a WhatsApp Business API platform that enables businesses to send and manage WhatsApp messages at scale.

[n8n](https://n8n.io/) is a [fair-code licensed](https://docs.n8n.io/reference/license/) workflow automation platform.

[Installation](#installation)
[Operations](#operations)
[Credentials](#credentials)
[Compatibility](#compatibility)
[Usage](#usage)
[Resources](#resources)

## Installation

Follow the [installation guide](https://docs.n8n.io/integrations/community-nodes/installation/) in the n8n community nodes documentation.

### Manual installation

To get started install the package in your n8n root directory:

```bash
npm install @llw/n8n-nodes-aisensy
```

For Docker-based deployments, add the following line before the font installation command in your n8n Dockerfile:

```
RUN cd /usr/local/lib/node_modules/n8n && npm install @llw/n8n-nodes-aisensy
```

## Operations

### Fetch Campaigns
- Retrieve available campaigns from AiSensy
- Select a campaign and provide template parameters dynamically
- Supports up to 5 template parameters
- Returns campaign details including template text and parameters

### Send Message
- Send WhatsApp messages using a campaign
- Requires campaign name, phone number, contact name, and template parameters
- Uses data from Fetch Campaigns action

## Credentials

You will need the following credentials to use this node:

- **Project ID**: Your AiSensy Project ID
- **API Password**: Your AiSensy Project API Password (X-AiSensy-Project-API-Pwd header)

You can obtain these credentials from your AiSensy dashboard.

## Compatibility

- Tested with n8n version 1.0.0 and above
- Minimum n8n version required: 0.200.0

## Usage

### Basic Workflow Example

1. **Fetch Campaign and Configure Parameters**:
   - Add the AiSensy node
   - Select "Fetch Campaigns" operation
   - Choose a campaign from the dropdown
   - Fill in template parameters (based on campaign requirements)
   - The node outputs campaign details and parameters

2. **Send Message**:
   - Add another AiSensy node
   - Select "Send Message" operation
   - Use data from previous node (campaign name and parameters)
   - Provide phone number and contact name
   - Execute to send WhatsApp message

### Example: Send Welcome Message

```
Trigger → Fetch Campaigns (select "welcome_message" campaign, fill name parameter)
       → Send Message (use campaign data, add phone number)
```

## Resources

* [n8n community nodes documentation](https://docs.n8n.io/integrations/community-nodes/)
* [AiSensy API Documentation](https://docs.aisensy.com/)

## Development

### Setup

1. Clone this repository
2. Install dependencies: `npm install`
3. Build the node: `npm run build`
4. Link for local development: `npm link`

### Build

```bash
npm run build
```

### Lint

```bash
npm run lint
npm run lintfix  # to auto-fix issues
```

### Testing

```bash
npm test                 # Run all tests
npm run test:watch      # Run tests in watch mode
npm run test:coverage   # Run tests with coverage report
```

See `__tests__/README.md` for detailed testing documentation.

## License

[MIT](LICENSE.md)