protected override async Task <ResourceResponse> OnUpdateActivityAsync(ClaimsIdentity claimsIdentity, string conversationId, string activityId, Activity activity, CancellationToken cancellationToken = default) { await this.PrepareActivity(activity); var conversationExists = await this._helper.ConversationHistoryExistsAsync(conversationId); if (!conversationExists) { var resource = new IndirectLineConversationResourceResponse { Id = activity.Id, Status = 400, Description = $"Conversation with id={conversationId} doesn't exist!", }; return(resource); } this._logger.LogWarning($"attempt to invoke {nameof(OnUpdateActivityAsync)} method, but this method is not allowed"); return(new IndirectLineConversationResourceResponse { Id = activity.Id, Status = 400, Description = "{Update Activity} is not allowed", }); }
protected override async Task <ResourceResponse> OnSendToConversationAsync(ClaimsIdentity claimsIdentity, string conversationId, Activity activity, CancellationToken cancellationToken = default) { await this.PrepareActivity(activity); var conversationExists = await this._helper.ConversationHistoryExistsAsync(conversationId); if (!conversationExists) { var resource = new IndirectLineConversationResourceResponse { Id = activity.Id, Status = 400, Description = $"Conversation with id={conversationId} doesn't exist!", }; return(resource); } await this._helper.AddActivityToConversationHistoryAsync(conversationId, activity); this._logger.LogInformation("message from bot received: \r\nConversationId={0}\r\nActivity.Id={1}\tActivityType={2}\tMessageText={3}", conversationId, activity.Id, activity.Type, activity.Text); return(new ResourceResponse { Id = activity.Id }); }