Skip to content

Commit

Permalink
add lark webhook (#81)
Browse files Browse the repository at this point in the history
  • Loading branch information
LeoQuote authored Nov 15, 2021
1 parent fa6cefe commit 901e473
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions helpdesk/libs/notification.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,31 @@ async def send(self):
}
r = requests.post(WEBHOOK_URL, json=msg, timeout=3)
r.raise_for_status()


class LarkWebhookNotification(Notification):
method = 'webhook'

async def send(self):
if not WEBHOOK_URL:
return
title, content = self.render()
msg = {
"config": {
"wide_screen_mode": True
},
"elements": [
{
"tag": "markdown",
"content": content
}
],
"header": {
"title": {
"content": "helpdesk",
"tag": "plain_text"
}
}
}
r = requests.post(WEBHOOK_URL, json=msg)
r.raise_for_status()

0 comments on commit 901e473

Please sign in to comment.