chore: slack push DM's

This commit is contained in:
Saahil 2024-09-11 09:52:13 -04:00 committed by GitHub
parent 8087d24914
commit 0383e7ebec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 26 additions and 2 deletions

View file

@ -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"
}
}
}

View file

@ -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;