Overview
The app provides several functionalities, including:
- Event Handling: Utilizing Slack's Events API and Socket Mode, the app listens for specific Slack events.
- Dashboard Replication: It fetches available Datadog dashboards and presents a dropdown list to the user. After a dashboard selection, it creates a replica in Datadog.
- Name Generation: Generates a fun, randomized name for the replica dashboard.
- Environment Configuration: The app sources its configuration from an
.env
file.
Key Features
-
Slack Interactivity:
- Replies with a greeting to "hello" messages.
- Opens a dashboard selection modal on the 'replica' shortcut command.
- Posts messages with links to the replicated dashboard and a merge option.
-
Datadog Integration:
- Retrieves available dashboards from Datadog.
- Facilitates dashboard replication.
Prerequisites
To set up the app:
-
Clone this repository.
-
Copy .env.example
and rename it to .env
.
-
Fill in the required values in .env
:
SLACK_APP_TOKEN=xapp-xxxxxx
SLACK_BOT_TOKEN=xoxb-xxxxxx
DATADOG_API_KEY=
DATADOG_APP_KEY=
SLACK_CHANNEL_ID=
-
Install necessary Go libraries with go get
.
-
Run the app using go run main.go
.
Permissions and Settings
OAuth Scopes
The Replica
app requires the following OAuth scopes for functionality:
User Scopes
chat:write
: To send messages as the user.
Bot Scopes
chat:write
: To send messages in channels.
commands
: To add slash commands and shortcuts.
app_mentions:read
: To read messages that mention the app.
channels:history
: To access the message history of channels.
channels:read
: To view channels in Slack.
im:read
: To view direct messages.
im:write
: To send direct messages.
mpim:history
: To access multi-party direct message history.
im:history
: To access direct message history.
groups:history
: To access private channel message history.
Event Subscriptions
The app listens to the following bot events:
app_mention
: When the app is mentioned.
message.channels
: Messages in public channels.
message.groups
: Messages in private channels.
message.im
: Direct messages.
message.mpim
: Multi-party direct messages.
Interactivity and Shortcuts
- Interactivity is enabled for the app.
- The app includes a global shortcut named "Create a Replica" for creating Datadog dashboard replicas.
- Request URLs for interactivity and message menu options are set to
https://localhost:8080
.
Additional Settings
- Socket mode is enabled, allowing the app to use WebSockets for receiving events.
- Organization-wide deployment is not enabled (
org_deploy_enabled: false
).
- Token rotation is not enabled (
token_rotation_enabled: false
).
🤝 Contributing
Contributions, issues and feature requests are welcome!
📄 License
This project is MIT licensed.
Author