@backpack/amazon-sns
️ 📡
Utilities for publishing messages to Amazon SNS.
Installing
First, ensure you have set up Nexus as private registry needed to use Backpack.
Then, install the package using npm:
bash
npm install @backpack/amazon-sns
Make sure to also install the following AWS SDK client:
bash
npm install @aws-sdk/client-sns
SnsPublisher
Utility class to publish messages.
ts
import { SNSClient } from "@aws-sdk/client-sns";
import { SnsPublisher } from "@backpack/amazon-sns";
const client = new SNSClient();
const publisher = new SnsPublisher(client, "my-topic-arn");
// publishes the message as raw payload
await publisher.publishRaw("raw payload");
// publishes the message as JSON payload
await publisher.publishJson({ foo: 'Foo' });