【发布时间】:2020-06-09 04:15:29
【问题描述】:
我在 AWS 服务下创建了一个 Lex 聊天机器人。也使用测试聊天机器人会话对其进行测试。
我想在 .net 上创建一个 Web 服务,它可以将请求作为 Intent/Messages 发送并从同一个 amazon lex 聊天机器人获取响应。
【问题讨论】:
-
我为 AWS cognito 创建了一个联合服务,并将策略分配给了 RunLexBots。我很难找到使用 AppClientID 和 PoolID 访问 AWS Lex 服务和发送消息的方法。
-
以下是我使用代码 System.Runtime.CompilerServices.AsyncTaskMethodBuilder
1+AsyncStateMachineBox1[Amazon.Lex.Model.PostTextResponse,Amazon.Runtime.Internal.MetricsHandler+d__1 得到的响应1[Amazon.Lex.Model.PostTextResponse]] -
var amazonPostRequest = new Amazon.Lex.Model.PostTextRequest(); amazonPostRequest.BotAlias = "XX"; amazonPostRequest.BotName = "XX"; amazonPostRequest.UserId = "XX"; amazonPostRequest.InputText = "订车"; var amazonLexClient = new AmazonLexClient("AccessKey", "SecretKey", Amazon.RegionEndpoint.USEast1);任务
amazonPostResponse = amazonLexClient.PostTextAsync(amazonPostRequest); Console.WriteLine(amazonPostResponse.ToString());
标签: .net amazon-lex