Created
May 22, 2017 10:06
-
-
Save rainmakerho/85ddada30d28e4f79d9d85a5a062cf50 to your computer and use it in GitHub Desktop.
直接 Reply Message 給 User
This file contains hidden or 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
| public async Task<HttpResponseMessage> Post([FromBody]Activity activity) | |
| { | |
| if (activity.Type == ActivityTypes.Message) | |
| { | |
| var replyMessage = $"你輸入了 **{activity.Text}**,共輸入了**{activity.Text.Length}**個字"; | |
| //建立要回覆的 Activity | |
| var reply = activity.CreateReply(replyMessage); | |
| //建立連線 | |
| var connector = new ConnectorClient(new Uri(activity.ServiceUrl)); | |
| await connector.Conversations.ReplyToActivityAsync(reply); | |
| } | |
| else | |
| { | |
| await HandleSystemMessage(activity); | |
| } | |
| var response = Request.CreateResponse(HttpStatusCode.OK); | |
| return response; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment