Skip to content

Commit

Permalink
add multiple webhooks support (#93)
Browse files Browse the repository at this point in the history
* add multiple webhooks support

* donot change method name
  • Loading branch information
LeoQuote authored Nov 16, 2021
1 parent 03e4a83 commit 14c61a9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions helpdesk/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
NOTIFICATION_TITLE_PREFIX = ''
NOTIFICATION_METHODS = []

LARK_WEBHOOK_URL = ""

OPENID_PRIVIDERS = {}
AUTHORIZED_EMAIL_DOMAINS = []

Expand Down
5 changes: 3 additions & 2 deletions helpdesk/libs/notification.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from helpdesk.config import (
NOTIFICATION_TITLE_PREFIX,
WEBHOOK_URL,
LARK_WEBHOOK_URL,
ADMIN_EMAIL_ADDRS,
FROM_EMAIL_ADDR,
SMTP_SERVER,
Expand Down Expand Up @@ -134,7 +135,7 @@ class LarkWebhookNotification(Notification):
method = 'webhook'

async def send(self):
if not WEBHOOK_URL:
if not LARK_WEBHOOK_URL:
return
title, content = self.render()
msg = {
Expand All @@ -154,7 +155,7 @@ async def send(self):
}
}
}
r = requests.post(WEBHOOK_URL, json={"msg_type": "interactive", "card": msg})
r = requests.post(LARK_WEBHOOK_URL, json={"msg_type": "interactive", "card": msg})
if r.status_code == 200 and r.json()["StatusCode"] == 0:
return
else:
Expand Down

0 comments on commit 14c61a9

Please sign in to comment.