skip to Main Content

I am interested in capturing the event of the user typing in my bot through the DirectLine API (REST).

Botframework documentation says this is possible: […] typing Indicates that the user or bot on the other end of the conversation is compiling a response […]

This answer says Facebook Messenger does not support it (2017).

Perhaps some channels (Slack, Skype…) might support this, others don’t (Facebook).

Perhaps I just didn’t find the right place in documentation to make it work, if so, any link I can follow?

Any representative of either Azure / Facebook who can provide insight about this being in the roadmap and ETA?

Thanks in advance for the answers!!!

2

Answers


  1. Chosen as BEST ANSWER

    This looks like a limitation as of Feb 2018.

    Confirmed for Facebook Messenger and Slack by now.

    I will take @oflahero and mine own experience + no answers on these threads (with MS guys having tagged it) as a NO, this cannot be done:

    No confirmation about it being in roadmap/ETA.

    [Edit]: Alive conversation at Botframework Github here.


  2. Currently BotFramework works by sending whole messages (to MessageController’s ‘Post’ method if using C#, for example), once the user hits send/return. There’s no magic AJAX going on in the background sending individual keystroke info to the bot, unfortunately.

    However, there is such a value in the ActivityTypes enum called ‘Typing’. This is typically used by the bot to send an ‘I’m typing’ indicator to the user, if you want to buy time. This is what the doc you’re referring to is talking about:

            var msg = context.MakeMessage();
            msg.Text = string.Empty;
            msg.Type = ActivityTypes.Typing;
            await context.PostAsync(msg);
    

    But, for the user typing TO the bot – the question is, does your channel support sending an activity of type ActivityTypes.Typing to the bot? Try finding out by having a look at the HandleSystemMessage method in your MessagesController and add some handler code. The boilerplate handles a selection of the enum values, including Typing (but currently does nothing):

            ....
            else if (message.Type == ActivityTypes.Typing)
            {
                // Handle knowing that the user is typing
            }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search