Reputation: 181
I am trying to make my chatbot display the initial welcome message without the user having to type first to initiate conversation in webchat.
I have found this solution of using backchannel: here
but since the ApiController class is deprecated in .NET core 2.2
I cannot use this solution.
[BotAuthentication]
public class MessagesController : ApiController
{
public async Task<HttpResponseMessage> Post([FromBody]Activity activity)
{
. . .
if (activity.Type == ActivityTypes.Message)
{
await Conversation.SendAsync(activity, () => new Dialogs.RootDialog());
}
. . .
var response = Request.CreateResponse(HttpStatusCode.OK);
return response;
}
Because of this, in the above sample code provided in the solution, 'Conversation' and 'Request' do not exist in the current context.
I am looking for a version of the above solution that works with .NET core 2.2
.
Upvotes: 1
Views: 235
Reputation: 1347
Try inheriting from ControllerBase and using the ApiController declaration.
[ApiController]
public class BotController : ControllerBase
Upvotes: 1