Skip to content

Instantly share code, notes, and snippets.

@rainmakerho
Created May 22, 2017 10:06
Show Gist options
  • Select an option

  • Save rainmakerho/85ddada30d28e4f79d9d85a5a062cf50 to your computer and use it in GitHub Desktop.

Select an option

Save rainmakerho/85ddada30d28e4f79d9d85a5a062cf50 to your computer and use it in GitHub Desktop.
直接 Reply Message 給 User
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