2021-12-21 06:57:38 +00:00
|
|
|
import fetch from 'node-fetch'
|
|
|
|
|
|
|
|
export async function sendToFeishu(content: string) {
|
2021-12-27 02:47:27 +00:00
|
|
|
const URL = process.env.FEISHU_BOT_URL
|
2021-12-21 06:31:29 +00:00
|
|
|
const body = JSON.stringify({
|
|
|
|
"msg_type": "text",
|
|
|
|
"content": {
|
|
|
|
"text": content
|
|
|
|
}
|
|
|
|
})
|
|
|
|
const res = await fetch(URL, {
|
|
|
|
method: 'POST',
|
|
|
|
headers: {
|
|
|
|
'Content-Type': 'application/json'
|
|
|
|
},
|
|
|
|
body,
|
|
|
|
})
|
|
|
|
const data = await res.json()
|
|
|
|
if (data.StatusCode !== 0) {
|
|
|
|
console.error(data.StatusMessage)
|
|
|
|
}
|
|
|
|
}
|