Skip to content

Instantly share code, notes, and snippets.

@peted70
Created June 16, 2016 16:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peted70/941da73f59a617a83818f2abfd4d09ad to your computer and use it in GitHub Desktop.
Save peted70/941da73f59a617a83818f2abfd4d09ad to your computer and use it in GitHub Desktop.
namespace MSHealthBot
{
[BotAuthentication]
public class MessagesController : ApiController
{
/// <summary>
/// POST: api/Messages
/// Receive a message from a user and reply to it
/// </summary>
public async Task<Message> Post([FromBody]Message message)
{
if (message.Type == "Message")
{
// calculate something for us to return
int length = (message.Text ?? string.Empty).Length;
// return our reply to the user
return message.CreateReplyMessage($"You sent {length} characters");
}
else
{
return HandleSystemMessage(message);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment