You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

amazon-ads-sdk-ayas

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

amazon-ads-sdk-ayas

A comprehensive TypeScript/JavaScript SDK for Amazon Advertising API with full type support

1.0.1
latest
npmnpm
Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

Amazon Ads SDK

TypeScript/JavaScript SDK for Amazon Advertising API.

Installation

npm install amazon-ads-sdk-ayas

or

yarn add amazon-ads-sdk-ayas

Usage

import { AmazonAdsSDK } from 'amazon-ads-sdk-ayas';

const sdk = new AmazonAdsSDK({
  clientId: 'your-client-id',
  clientSecret: 'your-client-secret',
  refreshToken: 'your-refresh-token',
  region: 'EU',
  sandbox: false,
});

// Sponsored Products API
const campaigns = await sdk.sponsoredProducts.campaigns.list();
const adGroups = await sdk.sponsoredProducts.adGroups.list();

// Targeting API
const targeting = await sdk.targeting.targeting.list();
const negativeTargeting = await sdk.targeting.negativeTargeting.list();

Environment Variables

You can define the following variables in your .env file:

AMAZON_CLIENT_ID=your-client-id
AMAZON_CLIENT_SECRET=your-client-secret
AMAZON_REFRESH_TOKEN=your-refresh-token
AMAZON_REGION=EU
SANDBOX_MODE=false

Development

# Install dependencies
npm install

# Build for development
npm run build

# Run tests
npm test

# Run linting
npm run lint

Features

  • Full TypeScript support
  • Modular architecture with namespaces
  • Complete Sponsored Products API coverage
  • Comprehensive targeting options
  • Environment variables support
  • Built-in sandbox mode

API Structure

Sponsored Products

  • Campaigns
  • Ad Groups
  • Product Ads
  • Keywords
  • Negative Keywords
  • Campaign Negative Keywords
  • Keyword Recommendations
  • Campaign Optimization Rules

Targeting

  • Targeting
  • Negative Targeting
  • Campaign Negative Targeting
  • Product Targeting
  • Target Promotion Groups

Error Handling

The SDK uses a consistent error handling approach:

try {
  const campaigns = await sdk.sponsoredProducts.campaigns.list();
} catch (error) {
  if (error.response) {
    // Amazon API error
    console.error('API Error:', error.response.data);
  } else {
    // Network or other error
    console.error('Error:', error.message);
  }
}

Authentication

The SDK supports authentication through environment variables or direct configuration:

// Using environment variables
const sdk = new AmazonAdsSDK();

// Direct configuration
const sdk = new AmazonAdsSDK({
  clientId: 'your-client-id',
  clientSecret: 'your-client-secret',
  refreshToken: 'your-refresh-token',
  region: 'EU',
  sandbox: false,
});

Contributing

  • Fork the repository
  • Create your feature branch (git checkout -b feature/amazing-feature)
  • Commit your changes (git commit -m 'Add some amazing feature')
  • Push to the branch (git push origin feature/amazing-feature)
  • Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

For support, please open an issue in the GitHub repository or contact the maintainers directly.

Keywords

amazon

FAQs

Package last updated on 20 Apr 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts