n8n-nodes-aiml-image
Version:
n8n nodes for FriendGrid (SendGrid) and AIML API image generation
99 lines (72 loc) • 3.24 kB
Markdown
# n8n-nodes-awesome-n8n (FriendGrid)
Custom n8n node that creates contacts in SendGrid Marketing via the FriendGrid example.
- **Node name (search in editor)**: FriendGrid
- **Internal name**: `friendGrid`
- **Credential**: FriendGrid API (API Key)
## Installation
Local development/test install, following the official guide [Test your node](https://docs.n8n.io/integrations/creating-nodes/build/programmatic-style-node/#test-your-node):
1. Build the package in this repo root:
```bash
npm run build
npm link
```
2. Link into your n8n custom directory (create if missing):
- Windows: `%USERPROFILE%\.n8n\custom`
- macOS/Linux: `~/.n8n/custom`
```bash
cd ~/.n8n/custom
npm init -y
npm link n8n-nodes-awesome-n8n
```
3. Start n8n:
```bash
n8n start
```
4. In the editor, search for “FriendGrid”.
## Operations
- **Resource**: Contact
- **Operation**: Create
- Creates/updates a marketing contact in SendGrid
- HTTP: `PUT https://api.sendgrid.com/v3/marketing/contacts`
### Parameters
- **Email** (string, required): Email address of the contact.
- **Additional Fields** (collection, optional):
- First Name (`first_name`)
- Last Name (`last_name`)
The node supports multiple input items using `getInputData()` and will send each item’s contact in the `contacts` array as described in the docs [Step 3.5 – Add operations](https://docs.n8n.io/integrations/creating-nodes/build/programmatic-style-node/#step-35-add-operations).
## Credentials
- **FriendGrid API** (API Key)
- Header: `Authorization: Bearer <API_KEY>`
- Test request: `GET https://api.sendgrid.com/v3/marketing/contacts`
Create the credential in n8n and select it on the node.
## Usage
1. Add the FriendGrid node.
2. Set Resource = Contact, Operation = Create.
3. Enter Email or map it from previous nodes.
4. Optionally set Additional Fields.
5. Execute the workflow.
## Compatibility
- Node.js >= 20
- n8n 1.x
## Development
```bash
npm run dev # tsc --watch
npm run build # compile to dist and copy icons
npm run lint # check
npm run lintfix # fix
```
If the icon doesn’t show, ensure the node’s `icon` points to an SVG present in the same folder (`nodes/FriendGrid/sendGrid.svg`), then rebuild.
## Troubleshooting
- The node doesn’t appear in the editor:
- Ensure you searched for the node name “FriendGrid”, not the package name.
- Verify the link in your custom directory: `npm link n8n-nodes-awesome-n8n`.
- Restart n8n after rebuilding.
- Icon shows a broken image:
- Ensure `icon: { light: 'file:sendGrid.svg', dark: 'file:sendGrid.svg' }` and the SVG exists.
- Multiple items processing:
- The node loops over input items using `getInputData()` per the official guide.
## Resources
- n8n programmatic node guide – operations and batching: [Add operations](https://docs.n8n.io/integrations/creating-nodes/build/programmatic-style-node/#step-35-add-operations)
- n8n programmatic node guide – testing locally: [Test your node](https://docs.n8n.io/integrations/creating-nodes/build/programmatic-style-node/#test-your-node)
## License
MIT