mirror of
https://github.com/n8n-io/n8n-nodes-starter.git
synced 2025-12-16 01:13:01 -06:00
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
53 lines
1,013 B
TypeScript
53 lines
1,013 B
TypeScript
import type {
|
|
IAuthenticateGeneric,
|
|
ICredentialTestRequest,
|
|
ICredentialType,
|
|
INodeProperties,
|
|
} from 'n8n-workflow';
|
|
|
|
export class AutosendApi implements ICredentialType {
|
|
name = 'autosendApi';
|
|
|
|
displayName = 'Autosend API';
|
|
|
|
documentationUrl = 'https://docs.autosend.com/';
|
|
|
|
icon = 'file:../icons/autosend.svg' as const;
|
|
|
|
httpRequestNode = {
|
|
name: 'Autosend',
|
|
docsUrl: 'https://docs.autosend.com/',
|
|
apiBaseUrl: 'https://api.autosend.com/',
|
|
};
|
|
|
|
properties: INodeProperties[] = [
|
|
{
|
|
displayName: 'API Key',
|
|
name: 'apiKey',
|
|
type: 'string',
|
|
typeOptions: {
|
|
password: true,
|
|
},
|
|
default: '',
|
|
required: true,
|
|
description: 'API key from your Autosend account settings',
|
|
},
|
|
];
|
|
|
|
authenticate: IAuthenticateGeneric = {
|
|
type: 'generic',
|
|
properties: {
|
|
headers: {
|
|
Authorization: '=Bearer {{$credentials.apiKey}}',
|
|
},
|
|
},
|
|
};
|
|
|
|
test: ICredentialTestRequest = {
|
|
request: {
|
|
baseURL: 'https://api.autosend.com',
|
|
url: '/contacts',
|
|
method: 'GET',
|
|
},
|
|
};
|
|
}
|