npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

alexa-announce

v1.0.0

Published

Wrapper of AWS JavaScript SDK's alexaforbusiness.SendAnnouncement()

Downloads

2

Readme

alexa-anounce

Wrapper of AWS JavaScript SDK's alexaforbusiness.SendAnnouncement()

Description

This package is a wrapper for the AWS SDK's alexaforbusiness.SendAnnouncement() method. It offers a simpler interface for quick and easy use in projects. If called from a Lambda, you can send an announcement in as little as 3 lines of code.

Usage

The best-case scenario is running this in a Lambda where env vars supply auth values. In that case, you can use it like this:

const aa = require('alexa-announce');
const Announcer = new aa.Announcer();

module.exports.handler = async(_event) => {
    await Announcer.announce('Hello world');
}

If you're running locally (or somewhere else) you'll need to specify credentials and optionally region like this:

const aa = require('alexa-announce');
const options = {
    region: 'us-east-1', // optional, default to us-east-1
    clientRequestToken: 'some idempotency token', // optinal, auto-generated if omitted
    timeToLiveInSeconds: 300, // optional, default to 300
    accessKeyId: 'your access key', // required if not provided by process.env
    secretAccessKey: 'your secret key' // required if not provided by process.env
}

const Announcer = new aa.Announcer(options); // pass options to constructor

(async () => {
    // You can capture the return value which has the format shown in the Output section
    let result = await Announcer.announce('This is an announcement from alexa announce');
    console.log(JSON.stringify(result));
})();

You can specify targets for the announcement by using classes exposed by the alexa-announce package. Here's an example, and if you need clarification on how to use these please consult the AWS API docs here: https://docs.aws.amazon.com/a4b/latest/APIReference/API_SendAnnouncement.html

const aa = require('alexa-announce');
const options = {
    accessKeyId: 'your access key',
    secretAccessKey: 'your secret key'
}
const Announcer = new aa.Announcer(options);

(async () => {

    Announcer.addTargets([

        // Ex. RoomTarget by filter string
        new aa.RoomTarget('Conference'),

        // Ex. ProfileTarget by filter string
        //new aa.ProfileTarget('Some Profile'),

        // Ex. RoomArnTarget by room Arn
        //new aa.RoomArnTarget('your arn'),

        // Ex. ProfileArnTarget by profile Arn
        //new aa.ProfileArnTarget('your arn')
    ]);

    let result = await Announcer.announce('This is an announcement from alexa announce');

    console.log(JSON.stringify(result));
})();

Methods

announce

announce('the string you want to be announced')

NOTE: Announcement must be 250 characters or fewer.

The output of the announce() method is just the output of the SendAnnouncement() method, which is an object containing the Arn of the announcement.

{
    "AnnouncementArn":"arn:aws:a4b:us-east-1:1234567890:announcement/123abc/lotsofstuff"
}

addTargets

addTargets(arrayOfTargets)

See example 3 above.

clearTargets

clearTargets()

No parameters or return value. Clears any targets specified previously, which has the effect of defaulting to all targets. Calling this is the same as calling targetAll()

targetAll

targetAll()

No parameters or return value. Clears any targets specified previously and targets all available devices.

Resources

AWS Environment Variables: https://docs.aws.amazon.com/lambda/latest/dg/configuration-envvars.html#configuration-envvars-runtime

API Reference for sendAnnouncement: https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/AlexaForBusiness.html#sendAnnouncement-property

API Guide for SendAnnouncement: https://docs.aws.amazon.com/a4b/latest/APIReference/API_SendAnnouncement.html