azure chatbot SDK4 - live(human) agent chat REST API integration not working issue

浪子不回头ぞ 提交于 2019-12-25 02:58:43

问题


I stuck with azure chat-bot framework SDK4 integration with live agent(human) chat through REST API using Node.js.

  1. I have an REST API, which needs to execute in the certain interval for getting information about human agent chat and status, and i need to send to user as an chat message.
  2. One more REST API, which will send chat message again again to live agent from user.

I am trying to implement this in azure chat-bot SDK V4 waterfall method getting failed.

async liveAgentMsg(step) {
var msgObjMessages = await getLiveAgentMessages(); // API call
if (msgObjMessages.length > 0) {
    for(var i = 0; i < msgObjMessages.length; i++) {
        var msgtype = msgObjMessages[i].type;
        if ('ChatRequestSuccess' == msgtype) {
            await step.context.sendActivity("Chat request success.");
        } else if ('ChatEstablished' == msgtype) {
            return await step.prompt('textPrompt', 'Live agent chat established.');
        } else if ('ChatMessage' == msgtype) {
            await step.context.sendActivity(msgObjMessages [i].message.text);
        } else if ('ChatEnded' == msgtype) {
            await step.context.sendActivity(msgtype);
            return await step.endDialog();
        } else {
            await step.context.sendActivity(msgtype);
        }
    }
    return await step.replaceDialog(SAME_DIALOG_ID);
} }    


async chatMsg(step) {
if (step.result) {
    var chatObj = await sendChatMessage(step.result);  // API Call
    if ("success" == chatObj) {
        return await step.replaceDialog(SAME_DIALOG_ID);
    } else {
        await step.context.sendActivity(chatObj);
    }
} 
return await step.endDialog(); }

Thanks in advance.

来源:https://stackoverflow.com/questions/55240098/azure-chatbot-sdk4-livehuman-agent-chat-rest-api-integration-not-working-iss

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