mirror of
https://github.com/n8n-io/n8n-nodes-starter.git
synced 2025-12-17 01:43:00 -06:00
Add Autosend node with Mail and Contact resources
Implement n8n node for Autosend API with support for: - Mail resource: Send single and bulk emails with template or custom content - Contact resource: Create/update contacts (upsert) and get contacts by ID or email - API key authentication - Declarative routing following n8n best practices - Full TypeScript support with proper typing - Passing all linting checks
This commit is contained in:
parent
2e9e5c61ed
commit
2f1ffde4a5
15 changed files with 1142 additions and 7 deletions
71
nodes/Autosend/Autosend.node.ts
Normal file
71
nodes/Autosend/Autosend.node.ts
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
import type {
|
||||
INodeType,
|
||||
INodeTypeDescription,
|
||||
INodeExecutionData,
|
||||
IExecuteFunctions,
|
||||
} from 'n8n-workflow';
|
||||
import { mailFields, mailOperations } from './resources/mail';
|
||||
import { contactFields, contactOperations } from './resources/contact';
|
||||
|
||||
export class Autosend implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
displayName: 'Autosend',
|
||||
name: 'autosend',
|
||||
icon: 'file:autosend.svg',
|
||||
group: ['transform'],
|
||||
version: 1,
|
||||
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
|
||||
description: 'Interact with Autosend API to send emails and manage contacts',
|
||||
defaults: {
|
||||
name: 'Autosend',
|
||||
},
|
||||
inputs: ['main'],
|
||||
outputs: ['main'],
|
||||
credentials: [
|
||||
{
|
||||
name: 'autosendApi',
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
requestDefaults: {
|
||||
baseURL: 'https://api.autosend.com',
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
},
|
||||
properties: [
|
||||
{
|
||||
displayName: 'Resource',
|
||||
name: 'resource',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
options: [
|
||||
{
|
||||
name: 'Mail',
|
||||
value: 'mail',
|
||||
description: 'Send emails using Autosend',
|
||||
},
|
||||
{
|
||||
name: 'Contact',
|
||||
value: 'contact',
|
||||
description: 'Manage contacts in Autosend',
|
||||
},
|
||||
],
|
||||
default: 'mail',
|
||||
},
|
||||
...mailOperations,
|
||||
...mailFields,
|
||||
...contactOperations,
|
||||
...contactFields,
|
||||
],
|
||||
usableAsTool: true,
|
||||
};
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
// This method is required but the declarative routing handles everything
|
||||
// This is only called if routing doesn't handle the request
|
||||
const items = this.getInputData();
|
||||
return [items];
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue