MS Teams Bot - End Of Conversation Activity Not Working

%3CLINGO-SUB%20id%3D%22lingo-sub-2199189%22%20slang%3D%22en-US%22%3EMS%20Teams%20Bot%20-%20End%20Of%20Conversation%20Activity%20Not%20Working%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2199189%22%20slang%3D%22en-US%22%3E%3CP%3EI%20am%20trying%20to%20implement%20master%20and%20skill%20bot%20in%20which%20Master%20Bot%20routes%20the%20request%20to%20specific%20Skill%20bot.%20After%20request%20reaches%20the%20skill%20bot%20%2C%20all%20incoming%20requests%20are%20handled%20by%20skill%20bot%20until%20it%20sends%3C%2FP%3E%3CDIV%3E%3CDIV%3E%3CSPAN%3EEndOfConversation%20Activity%20Type.%20When%20Master%20Bot%20identifies%20this%20activity%26nbsp%3B%20type%20%2C%20it%20ends%20the%20conversation%20and%20then%20user%20can%20converse%20with%20master%20bot.%26nbsp%3B%20For%20this%20i%20am%20using%20node%20js%20Skill.%20This%20code%20works%20fine%20in%20Bot%20Emulator%20but%20it%20gives%20error%20on%20MS%20Teams%20Bot.%26nbsp%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EBot.js%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CDIV%3E%3CDIV%3E%3CSPAN%3Eclass%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3BEchoBot%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3Eextends%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3BTeamsActivityHandler%7B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3Econstructor%3C%2FSPAN%3E%3CSPAN%3E()%26nbsp%3B%7B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3Esuper%3C%2FSPAN%3E%3CSPAN%3E()%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E%2F%2F%26nbsp%3BSee%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Faka.ms%2Fabout-bot-activity-message%26nbsp%3Bto%26nbsp%3Blearn%26nbsp%3Bmore%26nbsp%3Babout%26nbsp%3Bthe%26nbsp%3Bmessage%26nbsp%3Band%26nbsp%3Bother%26nbsp%3Bactivity%26nbsp%3Btypes%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Faka.ms%2Fabout-bot-activity-message%26nbsp%3Bto%26nbsp%3Blearn%26nbsp%3Bmore%26nbsp%3Babout%26nbsp%3Bthe%26nbsp%3Bmessage%26nbsp%3Band%26nbsp%3Bother%26nbsp%3Bactivity%26nbsp%3Btypes%3C%2FA%3E.%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3Ethis%3C%2FSPAN%3E%3CSPAN%3E.onMessage(%3C%2FSPAN%3E%3CSPAN%3Easync%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B(context%2C%26nbsp%3Bnext)%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E%3D%26gt%3B%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%7B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp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3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3Btype%3A%26nbsp%3BActivityTypes.%3C%2FSPAN%3E%3CSPAN%3EEndOfConversation%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3Bcode%3A%26nbsp%3BEndOfConversationCodes.%3C%2FSPAN%3E%3CSPAN%3ECompletedSuccessfully%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%7D)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%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2FSPAN%3E%3CSPAN%3Eawait%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3Bcontext.sendActivity(%3C%2FSPAN%3E%3CSPAN%3E'Say%26nbsp%3B%22end%22%26nbsp%3Bor%26nbsp%3B%22stop%22%26nbsp%3Band%26nbsp%3BI%5C'll%26nbsp%3Bend%26nbsp%3Bthe%26nbsp%3Bconversation%26nbsp%3Band%26nbsp%3Bback%26nbsp%3Bto%26nbsp%3Bthe%26nbsp%3Bparent.'%3C%2FSPAN%3E%3CSPAN%3E)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%7D%3C%2FSPAN%3E%3C%2FDIV%3E%3CBR%20%2F%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E%2F%2F%26nbsp%3BBy%26nbsp%3Bcalling%26nbsp%3Bnext()%26nbsp%3Byou%26nbsp%3Bensure%26nbsp%3Bthat%26nbsp%3Bthe%26nbsp%3Bnext%26nbsp%3BBotHandler%26nbsp%3Bis%26nbsp%3Brun.%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3Eawait%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3Bnext()%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%7D)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%7D%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7D%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EError%3A%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%5BonTurnError%5D%20unhandled%20error%3A%20Error%3A%20Unknown%20activity%20type%3CBR%20%2F%3E(node%3A10552)%20UnhandledPromiseRejectionWarning%3A%20Unhandled%20promise%20rejection%20(rejection%20id%3A%2012)%3A%20Error%3A%20BotFrameworkAdapter.processActivity()%3A%20500%20ERROR%3CBR%20%2F%3EError%3A%20activity.text%20with%20value%20%22Error%3A%20Unknown%20activity%20type%22%20must%20be%20of%20type%20string.%3CBR%20%2F%3Eat%20serializeBasicTypes%20(D%3A%5Chome%5Csite%5Cwwwroot%5Cnode_modules%5C%40azure%5Cms-rest-js%5Cdist%5CmsRest.node.js%3A709%3A23)%3CBR%20%2F%3Eat%20Serializer.serialize%20(D%3A%5Chome%5Csite%5Cwwwroot%5Cnode_modules%5C%40azure%5Cms-rest-js%5Cdist%5CmsRest.node.js%3A522%3A27)%3CBR%20%2F%3Eat%20serializeCompositeType%20(D%3A%5Chome%5Csite%5Cwwwroot%5Cnode_modules%5C%40azure%5Cms-rest-js%5Cdist%5CmsRest.node.js%3A908%3A50)%3CBR%20%2F%3Eat%20Serializer.serialize%20(D%3A%5Chome%5Csite%5Cwwwroot%5Cnode_modules%5C%40azure%5Cms-rest-js%5Cdist%5CmsRest.node.js%3A544%3A27)%3CBR%20%2F%3Eat%20getOperationArgumentValueFromParameterPath%20(D%3A%5Chome%5Csite%5Cwwwroot%5Cnode_modules%5C%40azure%5Cms-rest-js%5Cdist%5CmsRest.node.js%3A3462%3A24)%3CBR%20%2F%3Eat%20getOperationArgumentValueFromParameter%20(D%3A%5Chome%5Csite%5Cwwwroot%5Cnode_modules%5C%40azure%5Cms-rest-js%5Cdist%5CmsRest.node.js%3A3437%3A12)%3CBR%20%2F%3Eat%20serializeRequestBody%20(D%3A%5Chome%5Csite%5Cwwwroot%5Cnode_modules%5C%40azure%5Cms-rest-js%5Cdist%5CmsRest.node.js%3A3371%3A28)%3CBR%20%2F%3Eat%20ConnectorClient.ServiceClient.sendOperationRequest%20(D%3A%5Chome%5Csite%5Cwwwroot%5Cnode_modules%5C%40azure%5Cms-rest-js%5Cdist%5CmsRest.node.js%3A3348%3A13)%3CBR%20%2F%3Eat%20Conversations.replyToActivity%20(D%3A%5Chome%5Csite%5Cwwwroot%5Cnode_modules%5Cbotframework-connector%5Clib%5CconnectorApi%5Coperations%5Cconversations.js%3A54%3A28)%3CBR%20%2F%3Eat%20BotFrameworkAdapter.%3CANONYMOUS%3E%20(D%3A%5Chome%5Csite%5Cwwwroot%5Cnode_modules%5Cbotbuilder%5Clib%5CbotFrameworkAdapter.js%3A794%3A71)%3C%2FANONYMOUS%3E%3C%2FSPAN%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2199189%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EMicrosoft%20Teams%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2217397%22%20slang%3D%22en-US%22%3ERe%3A%20MS%20Teams%20Bot%20-%20End%20Of%20Conversation%20Activity%20Not%20Working%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2217397%22%20slang%3D%22en-US%22%3EHi%20%40Krati%2C%20we%20are%20working%20on%20it%20practically%20and%20taking%20this%20for%20internal%20discussion%20with%20team%20and%20will%20update%20you%20soon.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2237413%22%20slang%3D%22en-US%22%3ERe%3A%20MS%20Teams%20Bot%20-%20End%20Of%20Conversation%20Activity%20Not%20Working%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2237413%22%20slang%3D%22en-US%22%3EHi%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F719456%22%20target%3D%22_blank%22%3E%40KratiAgarwal1307%3C%2FA%3E%2C%20I%20am%20able%20to%20repro%20your%20issue%20from%20my%20end%20checking%20this%20with%20internal%20team%20%2C%20if%20it%20is%20a%20bug%20will%20raise%20a%20bug%20and%20let%20you%20know.%3C%2FLINGO-BODY%3E
New Contributor

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)
2 Replies
Hi @Krati, we are working on it practically and taking this for internal discussion with team and will update you soon.
Hi @KratiAgarwal1307, I am able to repro your issue from my end checking this with internal team , if it is a bug will raise a bug and let you know.