lib/webhooks/webhooks.js
function validateRequestWithBody(authToken, twilioHeader, requestUrl, body) {
  var urlObject = new url.URL(requestUrl);
  return validateRequest(authToken, twilioHeader, requestUrl, {}) && validateBody(body, urlObject.searchParams.get('bodySHA256'));
}
function validateRequestWithBody(authToken, twilioHeader, requestUrl, body) {
  var urlObject = new url.URL(requestUrl);
  return validateRequest(authToken, twilioHeader, requestUrl, {}) && validateBody(body, urlObject.searchParams.get('bodySHA256'));
}
function validateRequestWithBody ( authToken , twilioHeader , requestUrl , body ) { var urlObject = new url . URL ( requestUrl ) ; return validateRequest ( authToken , twilioHeader , requestUrl , { } ) && validateBody ( body , urlObject . searchParams . get ( 'bodySHA256' ) ) ; }
Utility function to validate an incoming request is indeed from Twilio. This also validates
the request body against the bodySHA256 post parameter.

@param {string} authToken - The auth token, as seen in the Twilio portal
@param {string} twilioHeader - The value of the X-Twilio-Signature header from the request
@param {string} requestUrl - The full URL (with query string) you configured to handle this request
@param {string} body - The body of the request
@returns {boolean} - valid
Utility function to validate an incoming request is indeed from Twilio . This also validates the request body against the bodySHA256 post parameter .