public async Task <IActionResult> Post([FromBody] Activity activity) { try { await adapter.ProcessActivty(this.Request.Headers["Authorization"].FirstOrDefault(), activity, BotReceiveHandler); return(this.Ok()); } catch (UnauthorizedAccessException) { return(this.Unauthorized()); } }
public async Task <IActionResult> Post([FromBody] Activity activity) { try { await adapter.ProcessActivty(this.Request.Headers["Authorization"].FirstOrDefault(), activity, OnReceiveActivity); return(this.Ok()); } catch (UnauthorizedAccessException) { return(this.Unauthorized()); } catch (InvalidOperationException e) { return(this.NotFound(e.Message)); } }
/// <summary> /// POST: api/Messages /// Receive a message from a user and reply to it /// </summary> public async Task <HttpResponseMessage> Post([FromBody] Activity activity) { try { await _adapter.ProcessActivty(this.Request.Headers.Authorization?.Parameter, activity, BotReceiveHandler); return(this.Request.CreateResponse(HttpStatusCode.OK)); } catch (UnauthorizedAccessException e) { return(this.Request.CreateErrorResponse(HttpStatusCode.Unauthorized, e.Message)); } catch (InvalidOperationException e) { return(this.Request.CreateErrorResponse(HttpStatusCode.NotFound, e.Message)); } }