Send a typing indicator in bot-framework v4 using DirectLine and webchat (Node.js)

…衆ロ難τιáo~ 提交于 2020-02-14 01:06:53

问题


The official docs for Microsoft bot-framework SDK v4 do not demonstrate how to send a typing indicator (whereas v3 has these instructions). I'm using DirectLine and botframework-webchat.

How do I do this? Thanks!


回答1:


You can send a typing indicator by sending an activity with the typing type. Read more about how to send a typing indicator.

await context.sendActivities([
            { type: ActivityTypes.Typing },
            { type: 'delay', value: 3000 },
            { type: ActivityTypes.Message, text: 'Finished typing' }
        ]);

Also the showTypingMiddleware can be used to automatically send the typing indicator. This snippet will also show how to send a typing indicator, if you are looking for more sample code.




回答2:


I believe you should do something like this

await context.sendActivities([
    { type: 'typing' },
    { type: 'delay', value: 2000 },
    { type: 'message', text: 'Your message here' }
]);


来源:https://stackoverflow.com/questions/53582445/send-a-typing-indicator-in-bot-framework-v4-using-directline-and-webchat-node-j

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!