mirror of
https://github.com/System-End/slack-end.git
synced 2026-04-19 16:28:19 +00:00
chore: slack push DM's
This commit is contained in:
parent
8087d24914
commit
0383e7ebec
2 changed files with 26 additions and 2 deletions
|
|
@ -10,10 +10,11 @@
|
|||
"dependencies": {
|
||||
"@slack/bolt": "^3.21.2",
|
||||
"dotenv": "^16.4.5",
|
||||
"smee-client": "^2.0.3"
|
||||
"smee-client": "^2.0.3",
|
||||
"body-parser": "latest"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ts-node": "^10.9.2",
|
||||
"typescript": "^5.5.4"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -13,6 +13,29 @@ export const app = new App({
|
|||
res.writeHead(302)
|
||||
res.end(`bye`)
|
||||
},
|
||||
}, {
|
||||
path: "/",
|
||||
method: ["POST"],
|
||||
handler(req, res) {
|
||||
const authHeader = req.headers['authorization']
|
||||
if (authHeader !== process.env.AUTH) {
|
||||
res.writeHead(401).end()
|
||||
return;
|
||||
}
|
||||
// pray this works
|
||||
require('body-parser').json(req, res, () => {
|
||||
//@ts-ignore
|
||||
console.log(req.body, 1)
|
||||
})
|
||||
//@ts-ignore
|
||||
console.log(`req.body`, req.body)
|
||||
app.client.chat.postMessage({
|
||||
channel: "C07LT7XS28Z",
|
||||
text: "todo"
|
||||
})
|
||||
res.writeHead(200)
|
||||
res.end();
|
||||
},
|
||||
}]
|
||||
});
|
||||
export default app;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue