npm

@aws-sdk/client-pinpoint
TypeScript icon, indicating that this package has built-in type declarations

3.691.0 • Public • Published

@aws-sdk/client-pinpoint

Description

AWS SDK for JavaScript Pinpoint Client for Node.js, Browser and React Native.

Doc Engage API - Amazon Pinpoint API

Installing

To install this package, simply type add or install @aws-sdk/client-pinpoint using your favorite package manager:

  • npm install @aws-sdk/client-pinpoint
  • yarn add @aws-sdk/client-pinpoint
  • pnpm add @aws-sdk/client-pinpoint

Getting Started

Import

The AWS SDK is modulized by clients and commands. To send a request, you only need to import the PinpointClient and the commands you need, for example ListTemplatesCommand:

// ES5 example
const { PinpointClient, ListTemplatesCommand } = require("@aws-sdk/client-pinpoint");
// ES6+ example
import { PinpointClient, ListTemplatesCommand } from "@aws-sdk/client-pinpoint";

Usage

To send a request, you:

  • Initiate client with configuration (e.g. credentials, region).
  • Initiate command with input parameters.
  • Call send operation on client with command object as input.
  • If you are using a custom http handler, you may call destroy() to close open connections.
// a client can be shared by different commands.
const client = new PinpointClient({ region: "REGION" });

const params = {
  /** input parameters */
};
const command = new ListTemplatesCommand(params);

Async/await

We recommend using await operator to wait for the promise returned by send operation as follows:

// async/await.
try {
  const data = await client.send(command);
  // process data.
} catch (error) {
  // error handling.
} finally {
  // finally.
}

Async-await is clean, concise, intuitive, easy to debug and has better error handling as compared to using Promise chains or callbacks.

Promises

You can also use Promise chaining to execute send operation.

client.send(command).then(
  (data) => {
    // process data.
  },
  (error) => {
    // error handling.
  }
);

Promises can also be called using .catch() and .finally() as follows:

client
  .send(command)
  .then((data) => {
    // process data.
  })
  .catch((error) => {
    // error handling.
  })
  .finally(() => {
    // finally.
  });

Callbacks

We do not recommend using callbacks because of callback hell, but they are supported by the send operation.

// callbacks.
client.send(command, (err, data) => {
  // process err and data.
});

v2 compatible style

The client can also send requests using v2 compatible style. However, it results in a bigger bundle size and may be dropped in next major version. More details in the blog post on modular packages in AWS SDK for JavaScript

import * as AWS from "@aws-sdk/client-pinpoint";
const client = new AWS.Pinpoint({ region: "REGION" });

// async/await.
try {
  const data = await client.listTemplates(params);
  // process data.
} catch (error) {
  // error handling.
}

// Promises.
client
  .listTemplates(params)
  .then((data) => {
    // process data.
  })
  .catch((error) => {
    // error handling.
  });

// callbacks.
client.listTemplates(params, (err, data) => {
  // process err and data.
});

Troubleshooting

When the service returns an exception, the error will include the exception information, as well as response metadata (e.g. request id).

try {
  const data = await client.send(command);
  // process data.
} catch (error) {
  const { requestId, cfId, extendedRequestId } = error.$metadata;
  console.log({ requestId, cfId, extendedRequestId });
  /**
   * The keys within exceptions are also parsed.
   * You can access them by specifying exception names:
   * if (error.name === 'SomeServiceException') {
   *     const value = error.specialKeyInException;
   * }
   */
}

Getting Help

Please use these community resources for getting help. We use the GitHub issues for tracking bugs and feature requests, but have limited bandwidth to address them.

To test your universal JavaScript code in Node.js, browser and react-native environments, visit our code samples repo.

Contributing

This client code is generated automatically. Any modifications will be overwritten the next time the @aws-sdk/client-pinpoint package is updated. To contribute to client you can check our generate clients scripts.

License

This SDK is distributed under the Apache License, Version 2.0, see LICENSE for more information.

Client Commands (Operations List)

CreateApp

Command API Reference / Input / Output

CreateCampaign

Command API Reference / Input / Output

CreateEmailTemplate

Command API Reference / Input / Output

CreateExportJob

Command API Reference / Input / Output

CreateImportJob

Command API Reference / Input / Output

CreateInAppTemplate

Command API Reference / Input / Output

CreateJourney

Command API Reference / Input / Output

CreatePushTemplate

Command API Reference / Input / Output

CreateRecommenderConfiguration

Command API Reference / Input / Output

CreateSegment

Command API Reference / Input / Output

CreateSmsTemplate

Command API Reference / Input / Output

CreateVoiceTemplate

Command API Reference / Input / Output

DeleteAdmChannel

Command API Reference / Input / Output

DeleteApnsChannel

Command API Reference / Input / Output

DeleteApnsSandboxChannel

Command API Reference / Input / Output

DeleteApnsVoipChannel

Command API Reference / Input / Output

DeleteApnsVoipSandboxChannel

Command API Reference / Input / Output

DeleteApp

Command API Reference / Input / Output

DeleteBaiduChannel

Command API Reference / Input / Output

DeleteCampaign

Command API Reference / Input / Output

DeleteEmailChannel

Command API Reference / Input / Output

DeleteEmailTemplate

Command API Reference / Input / Output

DeleteEndpoint

Command API Reference / Input / Output

DeleteEventStream

Command API Reference / Input / Output

DeleteGcmChannel

Command API Reference / Input / Output

DeleteInAppTemplate

Command API Reference / Input / Output

DeleteJourney

Command API Reference / Input / Output

DeletePushTemplate

Command API Reference / Input / Output

DeleteRecommenderConfiguration

Command API Reference / Input / Output

DeleteSegment

Command API Reference / Input / Output

DeleteSmsChannel

Command API Reference / Input / Output

DeleteSmsTemplate

Command API Reference / Input / Output

DeleteUserEndpoints

Command API Reference / Input / Output

DeleteVoiceChannel

Command API Reference / Input / Output

DeleteVoiceTemplate

Command API Reference / Input / Output

GetAdmChannel

Command API Reference / Input / Output

GetApnsChannel

Command API Reference / Input / Output

GetApnsSandboxChannel

Command API Reference / Input / Output

GetApnsVoipChannel

Command API Reference / Input / Output

GetApnsVoipSandboxChannel

Command API Reference / Input / Output

GetApp

Command API Reference / Input / Output

GetApplicationDateRangeKpi

Command API Reference / Input / Output

GetApplicationSettings

Command API Reference / Input / Output

GetApps

Command API Reference / Input / Output

GetBaiduChannel

Command API Reference / Input / Output

GetCampaign

Command API Reference / Input / Output

GetCampaignActivities

Command API Reference / Input / Output

GetCampaignDateRangeKpi

Command API Reference / Input / Output

GetCampaigns

Command API Reference / Input / Output

GetCampaignVersion

Command API Reference / Input / Output

GetCampaignVersions

Command API Reference / Input / Output

GetChannels

Command API Reference / Input / Output

GetEmailChannel

Command API Reference / Input / Output

GetEmailTemplate

Command API Reference / Input / Output

GetEndpoint

Command API Reference / Input / Output

GetEventStream

Command API Reference / Input / Output

GetExportJob

Command API Reference / Input / Output

GetExportJobs

Command API Reference / Input / Output

GetGcmChannel

Command API Reference / Input / Output

GetImportJob

Command API Reference / Input / Output

GetImportJobs

Command API Reference / Input / Output

GetInAppMessages

Command API Reference / Input / Output

GetInAppTemplate

Command API Reference / Input / Output

GetJourney

Command API Reference / Input / Output

GetJourneyDateRangeKpi

Command API Reference / Input / Output

GetJourneyExecutionActivityMetrics

Command API Reference / Input / Output

GetJourneyExecutionMetrics

Command API Reference / Input / Output

GetJourneyRunExecutionActivityMetrics

Command API Reference / Input / Output

GetJourneyRunExecutionMetrics

Command API Reference / Input / Output

GetJourneyRuns

Command API Reference / Input / Output

GetPushTemplate

Command API Reference / Input / Output

GetRecommenderConfiguration

Command API Reference / Input / Output

GetRecommenderConfigurations

Command API Reference / Input / Output

GetSegment

Command API Reference / Input / Output

GetSegmentExportJobs

Command API Reference / Input / Output

GetSegmentImportJobs

Command API Reference / Input / Output

GetSegments

Command API Reference / Input / Output

GetSegmentVersion

Command API Reference / Input / Output

GetSegmentVersions

Command API Reference / Input / Output

GetSmsChannel

Command API Reference / Input / Output

GetSmsTemplate

Command API Reference / Input / Output

GetUserEndpoints

Command API Reference / Input / Output

GetVoiceChannel

Command API Reference / Input / Output

GetVoiceTemplate

Command API Reference / Input / Output

ListJourneys

Command API Reference / Input / Output

ListTagsForResource

Command API Reference / Input / Output

ListTemplates

Command API Reference / Input / Output

ListTemplateVersions

Command API Reference / Input / Output

PhoneNumberValidate

Command API Reference / Input / Output

PutEvents

Command API Reference / Input / Output

PutEventStream

Command API Reference / Input / Output

RemoveAttributes

Command API Reference / Input / Output

SendMessages

Command API Reference / Input / Output

SendOTPMessage

Command API Reference / Input / Output

SendUsersMessages

Command API Reference / Input / Output

TagResource

Command API Reference / Input / Output

UntagResource

Command API Reference / Input / Output

UpdateAdmChannel

Command API Reference / Input / Output

UpdateApnsChannel

Command API Reference / Input / Output

UpdateApnsSandboxChannel

Command API Reference / Input / Output

UpdateApnsVoipChannel

Command API Reference / Input / Output

UpdateApnsVoipSandboxChannel

Command API Reference / Input / Output

UpdateApplicationSettings

Command API Reference / Input / Output

UpdateBaiduChannel

Command API Reference / Input / Output

UpdateCampaign

Command API Reference / Input / Output

UpdateEmailChannel

Command API Reference / Input / Output

UpdateEmailTemplate

Command API Reference / Input / Output

UpdateEndpoint

Command API Reference / Input / Output

UpdateEndpointsBatch

Command API Reference / Input / Output

UpdateGcmChannel

Command API Reference / Input / Output

UpdateInAppTemplate

Command API Reference / Input / Output

UpdateJourney

Command API Reference / Input / Output

UpdateJourneyState

Command API Reference / Input / Output

UpdatePushTemplate

Command API Reference / Input / Output

UpdateRecommenderConfiguration

Command API Reference / Input / Output

UpdateSegment

Command API Reference / Input / Output

UpdateSmsChannel

Command API Reference / Input / Output

UpdateSmsTemplate

Command API Reference / Input / Output

UpdateTemplateActiveVersion

Command API Reference / Input / Output

UpdateVoiceChannel

Command API Reference / Input / Output

UpdateVoiceTemplate

Command API Reference / Input / Output

VerifyOTPMessage

Command API Reference / Input / Output

Readme

Keywords

none

Package Sidebar

Install

npm i @aws-sdk/client-pinpoint

Weekly Downloads

222,443

Version

3.691.0

License

Apache-2.0

Unpacked Size

2.75 MB

Total Files

437

Last publish

Collaborators

  • mattsb42-aws
  • kuhe
  • amzn-oss
  • aws-sdk-bot
  • trivikr-aws