https://github.com/seratch/new-relic-dashboard-in-slack
Tiny Bolt ⚡️ app demonstrating how to build Slack apps utilizing Slack's new features and New Relic APIs
https://github.com/seratch/new-relic-dashboard-in-slack
Last synced: 16 days ago
JSON representation
Tiny Bolt ⚡️ app demonstrating how to build Slack apps utilizing Slack's new features and New Relic APIs
- Host: GitHub
- URL: https://github.com/seratch/new-relic-dashboard-in-slack
- Owner: seratch
- License: mit
- Created: 2019-11-22T10:40:36.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-11-25T08:56:32.000Z (over 5 years ago)
- Last Synced: 2025-03-24T04:22:17.561Z (about 1 month ago)
- Language: JavaScript
- Homepage: https://newrelic.co.jp/events/meetup/observability-meetup-2
- Size: 40.9 MB
- Stars: 12
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Personalized New Relic Dashboard App in Slack
This tiny Bolt ⚡️ app demonstrates how to build Slack apps utilizing Slack's new features and New Relic APIs. This app displays the list of New Relic applications and Slack users can choose one to check from the list. Also, users can run NRQL (New Relic Query Language) queries in modals (=without leaving Slack).
## App Home
Slack apps can leverage any of [Block Kit](https://api.slack.com/block-kit), [a collection of powerful built-in UI components](https://api.slack.com/tools/block-kit-builder?mode=appHome), to make
[Home Tab](https://api.slack.com/surfaces/tabs) not only informative, furthermore interactive. This app illustrates how to build a kind of dashboard UI and also place buttons and drop-down menus in a user-friendly manner.
## Modals
Modals are dynamic and interactive space for collecting data from Slack users and displaying information. Needless to say, we can use [Block Kit](https://api.slack.com/tools/block-kit-builder?mode=modal) in modals. In addition, [Input blocks](https://api.slack.com/reference/block-kit/blocks#input) are available only in modals.
# Prerequisites
## Slack App
* Create a Slack App at https://api.slack.com/
* Sign up for App Home Beta (the feature is in the open beta as of Nov 2019)
* Enable bot scopes (`app_mentions:read`, `users:read`)
* Enable event subscriptions (`app_home_opened`, `app_mention`)
* Enable Interactive Components (Just set `Request URL` correctly and save the change)
* Install the App into your workspace
![]()
![]()
## New Relic
* REST API Key - `https://rpm.newrelic.com/accounts/{your account id}/integrations?page=api_keys`
* Insights API Key - `https://insights.newrelic.com/accounts/{your account id}/manage/api_keys`
# Local Development
```bash
export SLACK_APP_DEBUG=1
export SLACK_BOT_TOKEN=xoxb-xxx-yyy
export SLACK_SIGNING_SECRET=abc
npm i
npm run local
``````bash
docker build -t new-relic-app .
docker run \
-p 3000:3000 \
-e SLACK_APP_DEBUG=1 \
-e SLACK_BOT_TOKEN=xoxb-xxx-yyy \
-e SLACK_SIGNING_SECRET=abc \
-it new-relic-app
```Also, run [ngrok](https://ngrok.com/) on localhost and set the URL at `https://api.slack.com/apps/{your app id}`.
```bash
ngrok http 3000
```# Deployment
If you prefer using a real database, feel free to fork this repository 👍
## Heroku
[](https://heroku.com/deploy?template=https://github.com/seratch/new-relic-dashboard-in-slack/tree/master)
## Google Cloud Run
```bash
gcloud config list # make sure if the project is valid
export GLOUD_PROJECT={your project}
export IMAGE_NAME=new-relic-bolt-app
export SLACK_BOT_TOKEN=xoxb-xxx-yyy-zzz
export SLACK_SIGNING_SECRET=the-valuegit clone [email protected]:seratch/new-relic-dashboard-in-slack.git
cd new-relic-dashboard-in-slack# Build a Docker image and upload it to Google's registry
gcloud builds submit --tag gcr.io/${GLOUD_PROJECT}/${IMAGE_NAME} .# Deploy a Docker container to Google Cloud Run
gcloud run deploy \
--image gcr.io/${GLOUD_PROJECT}/${IMAGE_NAME} \
--platform managed \
--update-env-vars SLACK_BOT_TOKEN=${SLACK_BOT_TOKEN},SLACK_SIGNING_SECRET=${SLACK_SIGNING_SECRET}
```# Resources
* [Slack - Home Tab](https://api.slack.com/surfaces/tabs)
* [Slack - Modals](https://api.slack.com/block-kit/surfaces/modals)
* [New Relic REST API](https://docs.newrelic.com/docs/apis/rest-api-v2)
* [New Relic Insights API](https://docs.newrelic.com/docs/insights/insights-api)# License
The MIT License