File tree Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change 1+ function shouldValidate ( ) {
2+ return process . env . NODE_ENV !== 'test'
3+ }
4+
5+ export const webhookConfig = {
6+ protocol : 'https' ,
7+ host : process . env . DOMAIN ,
8+ validate : shouldValidate ( )
9+ }
Original file line number Diff line number Diff line change 11import { Router } from "express" ;
22import * as controllers from "../controllers" ;
3- import basicAuth from 'express-basic-auth'
43
4+ import twilio from 'twilio'
5+ import { webhookConfig } from '../config/webhookValidationConfig'
6+
7+ import basicAuth from 'express-basic-auth'
58const { AUTH_USERNAME , AUTH_PASSWORD } = process . env
69
710const router = Router ( ) ;
811
9- router . post ( "/conversations-post-event" , controllers . conversationsPostEvent . post ) ;
12+ router . post ( "/conversations-post-event" , twilio . webhook ( webhookConfig ) , controllers . conversationsPostEvent . post ) ;
1013
11- router . post ( "/inbound-call" , controllers . inboundCall . post ) ;
12- router . post ( "/join-conference" , controllers . joinConference . get )
14+ router . post ( "/inbound-call" , twilio . webhook ( webhookConfig ) , controllers . inboundCall . post ) ;
15+ router . post ( "/join-conference" , twilio . webhook ( webhookConfig ) , controllers . joinConference . get )
1316
1417router . post ( "/sessions" , basicAuth ( {
1518 users : { [ AUTH_USERNAME ] :AUTH_PASSWORD }
You can’t perform that action at this time.
0 commit comments