问题
I stuck with azure chat-bot framework SDK4 integration with live agent(human) chat through REST API using Node.js.
- 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.
- 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