mirror of
https://github.com/geekgeekrun/geekgeekrun.git
synced 2026-08-29 03:56:51 +08:00
add ding talk
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import { dingTalkAccessToken } from "../runtime/dingtalk.mjs"
|
||||
|
||||
export function createTextMessage (text) {
|
||||
return JSON.stringify({
|
||||
"msgtype": "text",
|
||||
"text": {
|
||||
"content": `${text}【geekgo】`
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export async function requestDingTalkNotify (body) {
|
||||
const url = new URL(`https://oapi.dingtalk.com/robot/send`)
|
||||
url.searchParams.append(
|
||||
'access_token',
|
||||
dingTalkAccessToken
|
||||
)
|
||||
|
||||
return await fetch(
|
||||
url,
|
||||
{
|
||||
method: 'post',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body
|
||||
}
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export const dingTalkAccessToken = ``
|
||||
Reference in New Issue
Block a user