Created
June 5, 2020 10:33
-
-
Save anuraj/41c8a6428fa7e2ce189cb69ae902e42d to your computer and use it in GitHub Desktop.
QnA Maker Zoom Integration code.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var kbServiceUrl = "https://appservice.azurewebsites.net/qnamaker/knowledgebases/id/generateAnswer"; | |
var kbAuthKey = "authkey"; | |
var answer = string.Empty; | |
using (var httpClient = httpClientFactory.CreateClient()) | |
{ | |
httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); | |
httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("EndpointKey", kbAuthKey); | |
var question = new JObject(); | |
question["question"] = cmd; | |
var questionContent = new StringContent(question.ToString(), Encoding.UTF8, "application/json"); | |
var questionResponse = await httpClient.PostAsync(kbServiceUrl, questionContent); | |
var answers = await questionResponse.Content.ReadAsStringAsync(); | |
var answersObject = JObject.Parse(answers); | |
answer = answersObject["answers"][0]["answer"].Value<string>(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment