Skip to content

trycourier/aws-node-notifications

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Serverless AWS Node Notifications

Powered by Courier

This template demonstrates how to make a simple HTTP API Endpoint with Node.js running on AWS Lambda and API Gateway using the Serverless Framework to send notifications.

Usage

Configuration

  1. Sign up for Courier account.
  2. Install and configure one of the many supported providers:
  3. Grab your Courier API Key from settings.
  4. Set the API Key value in the COURIER_AUTH_TOKEN environment variable.
    • In this example app it's done by storing it in AWS SSM Parameter Store

CORS is enabled by default to allow requests from any origin, so that you can test the application by making requests from any client-side app. You should limit the allowed origins to your own domain when using this on production.

Deployment

$ serverless deploy

After deploying, you should see output similar to:

Deploying aws-node-notifications to stage dev (us-east-1)

✔ Service deployed to stack aws-node-notifications-dev (152s)

endpoint: POST
 - https://xxxxxxxxxx.execute-api.us-east-1.amazonaws.com/
functions:
  notify: aws-node-notifications-dev-notify (1.9 kB)

Invocation

After successful deployment, you can call the created application via HTTP:

curl --request POST \
     --url https://xxxxxxx.execute-api.us-east-1.amazonaws.com/ \
     --data '
{
  "message": {
    "to": {
      "email": "[email protected]",
    },
    "content": {
      "title": "Hello",
      "body": "World"
    }
  }
}
'

See the Courier Send API docs for the supported request body formats.

Local development

You can invoke your function locally by using the following command:

serverless invoke local --function notify

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published