Skip to Content
ServicesSlack Service

Slack Service

The Slack Service allows you to send messages to Slack channels using Webhooks or the Slack API.

Usage

Initialization

The SlackService is instantiated manually with a specific provider and configuration.

import { SlackService } from '@orbitus/core/services/slack'; const slackService = new SlackService('slack', { token: process.env.SLACK_BOT_TOKEN });

Sending a Message

Send a text message to a specific channel.

await slackService.sendMessage({ channel: '#general', text: 'Hello from Orbitus! 🚀' });

Rate Limiting

The service implements rate limiting to comply with Slack’s API policies. If you exceed the rate limit, the service handles it gracefully or throws an error depending on the severity.

Configuration

Environment Variables

VariableDescription
SLACK_BOT_TOKENThe Bot User OAuth Token for your Slack app.

Provider Config

When initializing the service, you can pass a configuration object:

interface SlackProviderConfig { token: string; // potentially other options like signing secret }
Last updated on