https://github.com/seratch/new-relic-dashboard-in-slack-kotlin
Tiny Lightning ⚡️ 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-kotlin
Last synced: about 1 month ago
JSON representation
Tiny Lightning ⚡️ 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-kotlin
- Owner: seratch
- License: mit
- Created: 2019-11-22T15:28:43.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-11-27T12:56:01.000Z (over 5 years ago)
- Last Synced: 2025-01-20T22:13:33.469Z (3 months ago)
- Language: Kotlin
- Homepage: https://newrelic.co.jp/events/meetup/observability-meetup-2
- Size: 40.9 MB
- Stars: 3
- Watchers: 3
- Forks: 0
- 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 [Lightning](https://github.com/seratch/jslack/tree/master/jslack-lightning) ⚡️ 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
# macOS
export JAVA_HOME=$(/usr/libexec/java_home -v 11) # 11 or higherexport SLACK_BOT_TOKEN=xoxb-xxx-yyy
export SLACK_SIGNING_SECRET=abc
./gradlew bootRun
``````bash
docker build -t new-relic-jvm .
docker run -p 3000:3000 -it new-relic-jvm
```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 👍
```bash
# macOS
export JAVA_HOME=$(/usr/libexec/java_home -v 11) # 11 or higher./gradlew build
java -jar build/libs/new-relic-slack-app-home-*.jar
```# 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