TypeScript/JavaScript SDK for Amazon Advertising API.
npm install amazon-ads-sdk-ayas
or
yarn add amazon-ads-sdk-ayas
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();
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
# Install dependencies
npm install
# Build for development
npm run build
# Run tests
npm test
# Run linting
npm run lint
- Full TypeScript support
- Modular architecture with namespaces
- Complete Sponsored Products API coverage
- Comprehensive targeting options
- Environment variables support
- Built-in sandbox mode
- Campaigns
- Ad Groups
- Product Ads
- Keywords
- Negative Keywords
- Campaign Negative Keywords
- Keyword Recommendations
- Campaign Optimization Rules
- Targeting
- Negative Targeting
- Campaign Negative Targeting
- Product Targeting
- Target Promotion Groups
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);
}
}
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,
});
- 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
This project is licensed under the MIT License - see the LICENSE file for details.
For support, please open an issue in the GitHub repository or contact the maintainers directly.