c# - Reply with "Is Typing" message in Microsoft botframework -


i developing chatbot using microfsoftbotframework on c#.net , luis cognitive services.

i want when user type should reply typing or bot typing..

 public async task<httpresponsemessage> post([frombody]activity activity)             {                 trace.traceinformation($"type={activity.type} text={activity.text}");                  if (activity.type == activitytypes.message)                 {                     //await microsoft.bot.builder.dialogs.conversation.sendasync(activity, () => new contactonedialog());                      //implementation of typing indication                     connectorclient connector = new connectorclient(new system.uri(activity.serviceurl));                     activity istypingreply = activity.createreply("shuttlebot typing...");                     istypingreply.type = activitytypes.typing;                     await connector.conversations.replytoactivityasync(istypingreply);                      await conversation.sendasync(activity, () =>                     new exceptionhandlerdialog<object>(new shuttlebusdialog(), displayexception: true));                                               }                 else                 {                     handlesystemmessage(activity);                 }                 var response = request.createresponse(system.net.httpstatuscode.ok);                 return response;             } 

this code working says "typing" animation , goes next message. want should show message have set "shuttlebot typing...

see image here"

most of channels natively support "is typing" notifications. send typing activity message:

var reply = activity.createreply(string.empty); reply.type = activitytypes.typing; await activitycontext.sendresponse(reply); 

Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -