n8n-nodes-amazon-paapi-agent
Version:
n8n node for Amazon Affiliate API (PA API 5.0) with enhanced features including OffersV2 support, advanced filtering, and better error handling
148 lines (147 loc) • 4.99 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.AmazonPaApi = void 0;
class AmazonPaApi {
constructor() {
this.name = 'amazonPaApi';
this.displayName = 'Amazon PA API';
this.documentationUrl = 'https://webservices.amazon.com/paapi5/documentation/';
this.properties = [
{
displayName: 'Access Key',
name: 'accessKey',
type: 'string',
typeOptions: {
password: true,
},
default: '',
required: true,
description: 'The access key from your Amazon PA API credentials',
},
{
displayName: 'Secret Key',
name: 'secretKey',
type: 'string',
typeOptions: {
password: true,
},
default: '',
required: true,
description: 'The secret key from your Amazon PA API credentials',
},
{
displayName: 'Partner Tag',
name: 'partnerTag',
type: 'string',
default: '',
required: true,
description: 'Your Amazon Associate tracking ID (e.g., mystore-20)',
},
{
displayName: 'Marketplace',
name: 'marketplace',
type: 'options',
options: [
{
name: 'Australia',
value: 'www.amazon.com.au',
},
{
name: 'Brazil',
value: 'www.amazon.com.br',
},
{
name: 'Canada',
value: 'www.amazon.ca',
},
{
name: 'France',
value: 'www.amazon.fr',
},
{
name: 'Germany',
value: 'www.amazon.de',
},
{
name: 'India',
value: 'www.amazon.in',
},
{
name: 'Italy',
value: 'www.amazon.it',
},
{
name: 'Japan',
value: 'www.amazon.co.jp',
},
{
name: 'Mexico',
value: 'www.amazon.com.mx',
},
{
name: 'Netherlands',
value: 'www.amazon.nl',
},
{
name: 'Singapore',
value: 'www.amazon.sg',
},
{
name: 'Spain',
value: 'www.amazon.es',
},
{
name: 'Sweden',
value: 'www.amazon.se',
},
{
name: 'Turkey',
value: 'www.amazon.com.tr',
},
{
name: 'United Arab Emirates',
value: 'www.amazon.ae',
},
{
name: 'United Kingdom',
value: 'www.amazon.co.uk',
},
{
name: 'United States',
value: 'www.amazon.com',
},
],
default: 'www.amazon.com',
required: true,
description: 'The Amazon marketplace to use',
},
];
this.authenticate = {
type: 'generic',
properties: {
headers: {
'Content-Type': 'application/json',
},
},
};
this.test = {
request: {
baseURL: '={{$credentials.marketplace}}',
url: '/paapi5/getitems',
method: 'POST',
body: {
ItemIds: ['B08N5KWB9H'],
PartnerTag: '={{$credentials.partnerTag}}',
PartnerType: 'Associates',
Marketplace: '={{$credentials.marketplace}}',
Resources: ['ItemInfo.Title'],
},
headers: {
'Content-Type': 'application/json',
'X-Amz-Target': 'com.amazon.paapi5.v1.ProductAdvertisingAPIv1.GetItems',
},
},
};
}
}
exports.AmazonPaApi = AmazonPaApi;