/// <summary> /// POST: api/Messages /// Receive a message from a user and reply to it /// </summary> public async Task <HttpResponseMessage> Post([FromBody] Activity activity) { if (activity.GetActivityType() == ActivityTypes.Message) { await Conversation.SendAsync(activity, () => new Dialogs.RootDialog()); } else if (activity.Type == ActivityTypes.Invoke) { if (activity.Name == "fileConsent/invoke") { await HandleFileConsentActivity(activity); } else if (activity.IsComposeExtensionQuery()) { // Determine the response object to reply with var invokeResponse = await MessagingExtensionHelper.CreateResponse(activity); // Messaging Extensions require the response body to have the response data // explicitly return the response rather that falling thru to the default return return(Request.CreateResponse(HttpStatusCode.OK, invokeResponse)); } } else { await HandleSystemMessageAsync(activity); } var response = Request.CreateResponse(HttpStatusCode.OK); return(response); }
/// <summary> /// POST: api/Messages /// Receive a message from a user and reply to it /// </summary> public async Task <HttpResponseMessage> Post([FromBody] Activity activity) { if (activity.GetActivityType() == ActivityTypes.Message) { await Conversation.SendAsync(activity, () => new Dialogs.RootDialog()); } else if (activity.Type == ActivityTypes.Invoke) { if (activity.Name == "fileConsent/invoke") { await HandleFileConsentActivity(activity); } else if (activity.IsO365ConnectorCardActionQuery()) { Newtonsoft.Json.Linq.JObject ctx = activity.Value as Newtonsoft.Json.Linq.JObject; if ((string)ctx["actionId"] == "scheduleInterview") { activity.Text = "schedule interview invoke"; await Conversation.SendAsync(activity, () => new Dialogs.RootDialog()); } } else if (activity.IsComposeExtensionQuery()) { // Determine the response object to reply with var invokeResponse = await MessagingExtensionHelper.CreateResponse(activity); // Messaging Extensions require the response body to have the response data // explicitly return the response rather that falling thru to the default return return(Request.CreateResponse(HttpStatusCode.OK, invokeResponse)); } // Send teams Invoke along to the Dialog stack else if (activity.IsTeamsVerificationInvoke()) { await Conversation.SendAsync(activity, () => new Dialogs.RootDialog()); } } else { await HandleSystemMessageAsync(activity); } var response = Request.CreateResponse(HttpStatusCode.OK); return(response); }