# n8n

> Source: https://developers.anymail.watch/n8n/

The `n8n-nodes-anymail` community node gives n8n two nodes: **anymail** for actions and **anymail Trigger** for instant events. The source is on [GitHub](https://github.com/creathinkone/n8n-nodes-anymail) and the package is on [npm](https://www.npmjs.com/package/n8n-nodes-anymail), published with provenance.

## Install

In n8n open **Settings**, **Community nodes**, **Install** and enter `n8n-nodes-anymail`.

## Connect

1. In anymail open **Settings**, **Integrations**, **API keys** and create a key with the `read` and `write` scopes. It starts with `sgn_`.
2. In n8n add the **Anymail API** credential and paste the key. Leave **API URL** as it is.

n8n tests the credential with `GET /api/v1/workspaces`.

## The anymail node

| Resource | Operation | What it does |
|---|---|---|
| Prospect | Create or Update | Creates a prospect, or updates the one with the same email. Fields left empty keep their current value. Can also enrol it in a campaign. |
| Prospect | Get by Email | Returns the prospect, or no item when there is none. |
| Prospect | Search | Lists prospects. The email filter matches the whole address. |
| Campaign | Add Prospect | Enrols an existing prospect by email. The result is `enrolled`, `already-enrolled` or `suppressed`. An unknown email is an error. |
| Campaign | Start, Pause, Resume, Stop | Changes the campaign state. **Start sends real email.** |
| Suppression | Add | Never emails an address or a domain. An address already on the list is not an error. |

A campaign that uses `{{first_name}}` does not enrol a prospect without a first name. Fill the field in Create or Update.

## The anymail Trigger node

Pick one event. n8n subscribes through [`POST /hooks`](/webhook-subscriptions/) when the workflow is activated and removes the subscription when it is deactivated.

| Event | Fires when |
|---|---|
| New Reply | a prospect replies, before classification |
| Prospect Interested, Maybe Later, Not Interested | a reply is classified |
| Auto-Reply Received | a reply is an autoresponder |
| Email Bounced | a message bounces |
| Prospect Unsubscribed | a prospect uses the unsubscribe link |
| Link Clicked | a prospect clicks a tracked link |
| Email Opened | a tracked message is opened. Apple Mail opens it without a person. |
| New Prospect | a prospect is created |
| Campaign Paused, Campaign Completed | the campaign changes state |

anymail only accepts a public HTTPS webhook address that resolves. Set `WEBHOOK_URL` in a self-hosted n8n. A local n8n without a public address cannot subscribe.

## Limits

The node uses the same [rate limits](/limits-and-good-practice/) as the API. Do not put **Campaign, Start** in an unattended workflow without a human check.
