public async Task <string> webhook() { CustomLogger logger = new CustomLogger(); string PayLoad; logger.WriteLog(LogLevel.DEBUG, "Post request from vwo app"); using (StreamReader reader = new StreamReader(Request.Body, Encoding.UTF8)) { PayLoad = await reader.ReadToEndAsync(); } logger.WriteLog(LogLevel.DEBUG, "VWO webhook payload: " + PayLoad); if (string.IsNullOrEmpty(Defaults.WebhookSecretKey) == false) { logger.WriteLog(LogLevel.DEBUG, "WebhookSecretKey exists . VWO webhook authentication Checking."); if (Request.Headers["x-vwo-auth"].ToString() != Defaults.WebhookSecretKey) { logger.WriteLog(LogLevel.DEBUG, "VWO webhook authentication failed. Please check."); return("VWO webhook authentication failed. Please check."); } if (VWOClient != null) { logger.WriteLog(LogLevel.DEBUG, "Authentication passed and GetAndUpdateSettingsFile function is called"); await SettingsProvider.GetAndUpdateSettingsFile(VWOConfig.SDK.AccountId, VWOConfig.SDK.SdkKey); logger.WriteLog(LogLevel.DEBUG, "Setting file has been updated"); } } else { if (VWOClient != null) { logger.WriteLog(LogLevel.DEBUG, "GetAndUpdateSettingsFile function called"); await SettingsProvider.GetAndUpdateSettingsFile(VWOConfig.SDK.AccountId, VWOConfig.SDK.SdkKey); logger.WriteLog(LogLevel.DEBUG, "Setting file has been updated"); } } return(""); }