hapi-twilio-auth
v0.3.0
Published
Hapi plugin for Twilio webhook authentication
Downloads
106
Maintainers
Readme
hapi-twilio-auth
Hapi plugin for Twilio request validation.
install
npm i hapi-twilio-auth
usage
import hapi from '@hapi/hapi'
import hapiTwilioAuth from 'hapi-twilio-auth'
const { Server } = hapi
async function startServer() {
const server = new Server({
port: 3000,
})
await server.register(hapiTwilioAuth)
server.auth.strategy('twilio-auth', 'twilio-signature', {
baseUrl: 'https://mycompany.com/webhooks-path', // your twilio webhooks base url
twilioAuthToken: 'xxxxxxxxxxx', // your twilio auth token
})
server.route({
method: 'POST',
path: '/',
handler(request, h) {
// ...
},
})
await server.start()
}
startServer()