I'm trying to add a Typing activity to a long-running action in my bot, but I keep getting a "BadGateway" error. Most of the samples I've found seem to be for bot framework v3, so the types or methods don't appear any more, and I've tried a few options for v4 (using C#), like the following:
await turnContext.SendActivityAsync(new Activity() { Type = ActivityTypes.Typing });
or
var typingActivity = new Activity()
{
Type = ActivityTypes.Typing
//RelatesTo = turnContext.Activity
};
typingActivity.ApplyConversationReference(typingActivity.GetConversationReference());
or
var act2 = MessageFactory.Text(null);
act2.Type = ActivityTypes.Typing;
await turnContext.SendActivityAsync(act2);
all of these result in a BadGateway error.
Can someone guide me on where I'm going wrong?
The answer of Steven Kanberg has the right code, but unfortunately this is a service issue at the moment, as confirmed in this issue on Github.
When the issue is resolved, it should be posted in the Github issue above.