I have created a chatbot using Visual studio (c#) and Microsoft azure account. It replies well without error.
Now I want to my chatbot reply to display with the facebook username as the first default message.
It is also Ok .
But it is Repeatedly comming(FbUsername) for any question. It means I am sending Hi to my bot it will respond "Hi Durgaprasad" . again i am sending what is chat bot then my bot is Hi Durgaprasad and answer that question.
public async Task<HttpResponseMessage> Post([FromBody]Activity activity)
{
if (activity.Type == ActivityTypes.Message)
{
string userName = "";
if (activity.From.Name != null)
userName = activity.From.Name;
ConnectorClient connector = new ConnectorClient(new Uri(activity.ServiceUrl));
Activity reply = activity.CreateReply("hello" + userName);
activity.TextFormat = "GreetingIntent";
await connector.Conversations.ReplyToActivityAsync(reply);
await Conversation.SendAsync(activity, () => new Dialogs.RootDialog());
}
else
{
HandleSystemMessage(activity);
}
var response = Request.CreateResponse(HttpStatusCode.OK);
return response;
}