Skip to content

Instantly share code, notes, and snippets.

@jamesmundy
Last active November 19, 2018 23:58
Show Gist options
  • Save jamesmundy/124af91a4d034f952876f1a509997360 to your computer and use it in GitHub Desktop.
Save jamesmundy/124af91a4d034f952876f1a509997360 to your computer and use it in GitHub Desktop.
The Bot entry point for an ASP.NET Web Api
[BotAuthentication]
public class MessagesController : ApiController
{
private readonly ITableService _tableService;
public MessagesController(ITableService tableService)
{
_tableService = tableService;
}
public async Task<HttpResponseMessage> Post([FromBody] Activity activity)
{
if (activity.Type == ActivityTypes.Message ||
activity.Type == ActivityTypes.Event &&
activity.Value is InternalEventMessage)
await Conversation.SendAsync(activity,
() => new NewPostcardDialog(Conversation.Container.Resolve<IAppSettingsService>());
else
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