Skip to content

Easily build custom integrations for Serverless Dashbaord Notifications using Serverless Components

License

Notifications You must be signed in to change notification settings

serverless-components/dashboard-notification-handler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

serverless-notification-handler

 

Easily deploy a NodeJS or Python function for handling Serverless Insight Alert Notifications.

 

  1. Install
  2. Create
  3. Configure
  4. Deploy

 

1. Install

$ npm install -g serverless

2. Create

$ mkdir notification-forwarder && cd notification-forwarder

The directory should look something like this:

|- handler.js # OR handler.py
|- serverless.yml
|- .env         # your AWS api keys

the .env file should look like this

AWS_ACCESS_KEY_ID=XXX
AWS_SECRET_ACCESS_KEY=XXX

The handler.js or handler.py file should contain a function to handle an alert notification event from Serverless Insights.

module.exports.alert = (notification) => {
  console.log('got notification', notification);
}
def alert(notification):
    print('got notification', notification)

3. Configure

Configure your serverless.yml as follows:

# serverless.yml

name: notification-handler
stage: dev

notificationHandler:
  component: '@serverless/notification-handler'
  inputs:
    code: .
    handler: handler.alert
    env:
      FOOBAR: ${env.FOOBAR} # Optional, set any env vars for your code

4. Deploy

$ serverless

5. Configure the Serverless Dashboard

Paste the ARN printed in the output of the previous step into the SNS notification configuration on dashboard.serverless.com for your app.

 

New to Components?

Checkout the Serverless Components repo for more information.

About

Easily build custom integrations for Serverless Dashbaord Notifications using Serverless Components

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published