notifications-api-v1
The Selling Partner API for Notifications lets you subscribe to notifications that are relevant to a selling partner's business. Using this API you can create a destination to receive notifications, subscribe to notifications, delete notification subscriptions, and more.
Installing
yarn add @sp-api-sdk/notifications-api-v1
npm install @sp-api-sdk/notifications-api-v1
Getting Started
With grantless API
import {SellingPartnerApiAuth, AuthorizationScope} from '@sp-api-sdk/auth'
import {NotificationsApiClient} from '@sp-api-sdk/notifications-api-v1'
const auth = new SellingPartnerApiAuth({
clientId: '',
clientSecret: '',
scopes: [AuthorizationScope.NOTIFICATIONS],
secretAccessKey: '',
accessKeyId: '',
region: '',
role: {
arn: '',
}
})
const client = new NotificationsApiClient({
auth,
region: 'eu'
})
With access token
import {SellingPartnerApiAuth} from '@sp-api-sdk/auth'
import {NotificationsApiClient} from '@sp-api-sdk/notifications-api-v1'
const auth = new SellingPartnerApiAuth({
clientId: '',
clientSecret: '',
refreshToken: '',
secretAccessKey: '',
accessKeyId: '',
region: '',
role: {
arn: '',
}
})
const client = new NotificationsApiClient({
auth,
region: 'eu'
})
Handle Rate Limiting
If you want to let the SDK retry after each 429 responses, instanciate the client like this:
const client = new NotificationsApiClient({
auth,
region: 'eu',
rateLimiting: {
retry: true,
onRetry: (retryInfo) => console.log(retryInfo)
}
})
The SDK gets the rate limits for each routes from the API documentation
API documentation
See here