mirror of
https://github.com/cheveguerra/bot-whatsapp.git
synced 2026-04-19 03:59:17 +00:00
feat(provider): 🔥 add twilii (weoking)
This commit is contained in:
21
packages/provider/src/twilio/server.js
Normal file
21
packages/provider/src/twilio/server.js
Normal file
@@ -0,0 +1,21 @@
|
||||
const polka = require('polka')
|
||||
const parsePolka = require('@polka/parse')
|
||||
|
||||
class WebHookServer {
|
||||
incomingMsg = (req, res, next) => {
|
||||
const { body } = req
|
||||
let json = JSON.stringify({ error: 'Missing CSRF token', body })
|
||||
res.end(json)
|
||||
}
|
||||
|
||||
start = () => {
|
||||
polka()
|
||||
.use(parsePolka.urlencoded({ extended: false }))
|
||||
.post('/hook', this.incomingMsg)
|
||||
.listen(3000, () => {
|
||||
console.log(`> Running on localhost:3000 /hook`)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = WebHookServer
|
||||
Reference in New Issue
Block a user