Integrations
Heimdall NextJS SDK provides several integrations to enhance your application's functionality. This section covers the available integrations and how to set them up.
Slack Integration
The SDK includes built-in support for Slack integration, allowing you to receive notifications and manage your application through Slack.
Setup
Add the following environment variables to your .env.local:
# Required for Slack integration
HEIMDALL_SLACK_ENABLED=true
HEIMDALL_SLACK_WEBHOOK_URL=https://hooks.slack.com/services/...
# Optional Slack configuration
HEIMDALL_SLACK_EVENTS=user.signup,user.login,security.alert
HEIMDALL_SLACK_MIN_SEVERITY=warning
HEIMDALL_SLACK_CHANNEL=#heimdall-alerts
HEIMDALL_SLACK_USERNAME=Heimdall Bot
HEIMDALL_SLACK_ICON_EMOJI=:shield:
Configuration Options
| Variable | Required | Description |
|---|---|---|
HEIMDALL_SLACK_ENABLED | Yes | Set to true to enable Slack integration |
HEIMDALL_SLACK_WEBHOOK_URL | Yes | Your Slack webhook URL |
HEIMDALL_SLACK_EVENTS | No | Comma-separated list of events to receive (defaults to all events) |
HEIMDALL_SLACK_MIN_SEVERITY | No | Minimum severity level (info, warning, error, critical) |
HEIMDALL_SLACK_CHANNEL | No | Channel to send messages to (defaults to webhook's configured channel) |
HEIMDALL_SLACK_USERNAME | No | Custom username for the bot |
HEIMDALL_SLACK_ICON_EMOJI | No | Custom emoji for the bot's avatar |
Available Events
type EventType =
| 'user.signup'
| 'user.login'
| 'user.logout'
| 'user.ban'
| 'user.unban'
| 'organization.create'
| 'organization.delete'
| 'team.create'
| 'team.delete'
| 'role.assign'
| 'role.remove'
| 'permission.grant'
| 'permission.revoke'
| 'security.alert'
| 'system.error'
Example Configuration
// app/config/heimdall.ts
import { HeimdallConfig } from '@heimdall/nextjs'
export const heimdallConfig: HeimdallConfig = {
apiUrl: process.env.HEIMDALL_API_URL!,
clientId: process.env.HEIMDALL_CLIENT_ID!,
clientSecret: process.env.HEIMDALL_CLIENT_SECRET!,
slack: {
enabled: process.env.HEIMDALL_SLACK_ENABLED === 'true',
webhookUrl: process.env.HEIMDALL_SLACK_WEBHOOK_URL,
events: process.env.HEIMDALL_SLACK_EVENTS?.split(',') || [],
minSeverity: process.env.HEIMDALL_SLACK_MIN_SEVERITY as
| 'info'
| 'warning'
| 'error'
| 'critical',
channel: process.env.HEIMDALL_SLACK_CHANNEL,
username: process.env.HEIMDALL_SLACK_USERNAME,
iconEmoji: process.env.HEIMDALL_SLACK_ICON_EMOJI,
},
}
For more detailed information about the Slack integration, including available commands and message formatting, see the Slack Integration documentation.
