This bot addresses a key limitation in OpsGenie's native Slack integration: the requirement for individual OpsGenie user accounts and need to login to OpsGenie in Slack to create incidents. Using a single bot (API key), any Slack user can create incidents while the bot handles the automatic capture of user context, channel details, and team information. This reduces license costs and simplifies access management without sacrificing incident tracking capabilities.
- OpsGenie Account with:
- Admin access to create integrations
- Team management permissions
- Ability to create API keys
- Slack Workspace with:
- Admin access to create apps
- Permission to install apps to workspace
- Ability to create slash commands
- Clone the repository:
git clone https://github.com/hcavarsan/slack-opsgenie-bot
cd slack-opsgenie-bot
go mod download
- Set up environment variables:
cp .env.example .env
Configure your .env
file:
SLACK_SIGNING_SECRET=your_slack_signing_secret
SLACK_BOT_TOKEN=xoxb-your-slack-bot-token
OPSGENIE_API_KEY=your-opsgenie-api-key
OPSGENIE_TEAM_ID=your-opsgenie-team-id
OPSGENIE_DOMAIN=your-domain
- Start development environment:
make docker-up
# create the env.yaml file with the correct values:
cp env.yaml.example env.yaml
# Deploy to Cloud Functions
make deploy-cloud-function
Note: When deploying to Cloud Functions, PORT is automatically managed by the gcp.
# Build and run
make docker-run
# Start development environment
make docker-up
# Stop development environment
make docker-down
# Deploy to Cloud Functions
make deploy-cloud-function
# Build and run Docker container
make docker-run
- Use
/create-incident
in Slack - Fill out the incident form:
- Title (required)
- Description (optional)
- Priority (Critical/High/Medium/Low)
- Check DMs for confirmation
Priority Mapping:
Slack Selection | OpsGenie Priority |
---|---|
Critical | P1 |
High | P2 |
Medium | P3 |
Low | P4 |
chat:write - Send messages as the bot
commands - Create slash commands
im:write - Send direct messages
users:read - Access basic user information
- Slash Command:
Command: /create-incident
URL: https://your-domain/slack/commands
- Interactivity:
Request URL: https://your-domain/slack/interactivity
for slack app configuration, see slack-manifest.yaml
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
MIT License