private string Conversation(SessionsClient clientSessions, string authFilter, string joyUserId, Guid joyGuid, bool isReInit, BaseEntityModel model) { EventInput evnt = new EventInput { Name = isReInit ? "reinit_conversation_event" : "custom_welcome_event", LanguageCode = Language }; evnt.Parameters = new Google.Protobuf.WellKnownTypes.Struct(); Google.Protobuf.WellKnownTypes.Value v1 = new Google.Protobuf.WellKnownTypes.Value(); v1.StringValue = joyUserId; Google.Protobuf.WellKnownTypes.Value v2 = new Google.Protobuf.WellKnownTypes.Value(); v2.StringValue = authFilter; evnt.Parameters.Fields.Add("user_name", v1); evnt.Parameters.Fields.Add("token", v2); var response = clientSessions.DetectIntent( session: new SessionName(ConfigurationManager.AppSettings["DialogFlowAgentId"], joyGuid.ToString("N", CultureInfo.CurrentCulture)), queryInput: new QueryInput { Event = evnt } ); var queryResult = response.QueryResult; return(string.IsNullOrEmpty(queryResult.FulfillmentText) ? WelcomeExceptionMessage : string.Format(CultureInfo.CurrentCulture, WelcomeMessage, "Raju Singh")); }
private string InitConversation(SessionsClient clientSessions, string authFilter, string joyUserId, Guid joyGuid, BaseEntityModel model) { return(Conversation(clientSessions, authFilter, joyUserId, joyGuid, false, model)); }
private string GetAgentResponse(SessionsClient clientSessions, string joyText, string joyUserId, string authFilter, Guid joyGuid, BaseEntityModel model) { string result = string.Empty; var response = clientSessions.DetectIntent( session: new SessionName(ConfigurationManager.AppSettings["DialogFlowAgentId"], joyGuid.ToString("N", CultureInfo.CurrentCulture)), queryInput: new QueryInput { Text = new TextInput { Text = joyText, LanguageCode = Language } } ); var queryResult = response.QueryResult; result = queryResult.FulfillmentText; return(result); }