You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
jumpserver/apps/notifications/backends/slack.py

22 lines
512 B

from django.conf import settings
from common.sdk.im.slack import Slack as Client
from .base import BackendBase
class Slack(BackendBase):
account_field = 'slack_id'
is_enable_field_in_settings = 'AUTH_SLACK'
def __init__(self):
self.client = Client(
bot_token=settings.SLACK_BOT_TOKEN,
)
def send_msg(self, users, message, subject=None):
accounts, __, __ = self.get_accounts(users)
return self.client.send_text(accounts, message)
backend = Slack