I am trying to implement master and skill bot in which Master Bot routes the request to specific Skill bot. After request reaches the skill bot , all incoming requests are handled by skill bot until it sends
EndOfConversation Activity Type. When Master Bot identifies this activity type , it ends the conversation and then user can converse with master bot. For this i am using node js Skill. This code works fine in Bot Emulator but it gives error on MS Teams Bot.
Bot.js
class EchoBot extends TeamsActivityHandler{
constructor() {
super();
this.onMessage(async (context, next) => {
switch (context.activity.text.toLowerCase()) {
case 'end':
case 'stop':
await context.sendActivity({
type: ActivityTypes.EndOfConversation,
code: EndOfConversationCodes.CompletedSuccessfully
});
break;
default:
await context.sendActivity(`Echo (JS) : '${ context.activity.text }'`);
await context.sendActivity('Say "end" or "stop" and I\'ll end the conversation and back to the parent.');
}
// By calling next() you ensure that the next BotHandler is run.
await next();
});
}
}
Error:
[onTurnError] unhandled error: Error: Unknown activity type
(node:10552) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 12): Error: BotFrameworkAdapter.processActivity(): 500 ERROR
Error: activity.text with value "Error: Unknown activity type" must be of type string.
at serializeBasicTypes (D:\home\site\wwwroot\node_modules\@azure\ms-rest-js\dist\msRest.node.js:709:23)
at Serializer.serialize (D:\home\site\wwwroot\node_modules\@azure\ms-rest-js\dist\msRest.node.js:522:27)
at serializeCompositeType (D:\home\site\wwwroot\node_modules\@azure\ms-rest-js\dist\msRest.node.js:908:50)
at Serializer.serialize (D:\home\site\wwwroot\node_modules\@azure\ms-rest-js\dist\msRest.node.js:544:27)
at getOperationArgumentValueFromParameterPath (D:\home\site\wwwroot\node_modules\@azure\ms-rest-js\dist\msRest.node.js:3462:24)
at getOperationArgumentValueFromParameter (D:\home\site\wwwroot\node_modules\@azure\ms-rest-js\dist\msRest.node.js:3437:12)
at serializeRequestBody (D:\home\site\wwwroot\node_modules\@azure\ms-rest-js\dist\msRest.node.js:3371:28)
at ConnectorClient.ServiceClient.sendOperationRequest (D:\home\site\wwwroot\node_modules\@azure\ms-rest-js\dist\msRest.node.js:3348:13)
at Conversations.replyToActivity (D:\home\site\wwwroot\node_modules\botframework-connector\lib\connectorApi\operations\conversations.js:54:28)
at BotFrameworkAdapter.<anonymous> (D:\home\site\wwwroot\node_modules\botbuilder\lib\botFrameworkAdapter.js:794:71)