https://github.com/serverless-components/dashboard-notification-handler
Easily build custom integrations for Serverless Dashbaord Notifications using Serverless Components
https://github.com/serverless-components/dashboard-notification-handler
Last synced: 5 months ago
JSON representation
Easily build custom integrations for Serverless Dashbaord Notifications using Serverless Components
- Host: GitHub
- URL: https://github.com/serverless-components/dashboard-notification-handler
- Owner: serverless-components
- License: mit
- Created: 2019-10-04T14:48:04.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-04T14:38:21.000Z (about 3 years ago)
- Last Synced: 2025-04-08T19:52:31.009Z (8 months ago)
- Language: JavaScript
- Homepage:
- Size: 994 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# serverless-notification-handler
Easily deploy a NodeJS or Python function for handling Serverless Insight Alert Notifications.
1. [Install](#1-install)
2. [Create](#2-create)
3. [Configure](#3-configure)
4. [Deploy](#4-deploy)
### 1. Install
```console
$ npm install -g serverless
```
### 2. Create
```console
$ 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.
```python
module.exports.alert = (notification) => {
console.log('got notification', notification);
}
```
```python
def alert(notification):
print('got notification', notification)
```
### 3. Configure
Configure your `serverless.yml` as follows:
```yml
# 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
```console
$ 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](https://github.com/serverless/components) repo for more information.