I am working on a requirement in NodeJS where I have to invoke proactive messages from Skill Bot. I have a set Interval loop which runs for every 8 seconds where I added adapter.ContinueConversation method. I have added the below code in skill bot on message method initially but I received 401 Unauthorized error.
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.');
var adapter = context.adapter;
var conversationReference = TurnContext.getConversationReference(context.activity);
var refreshInterval = setInterval(async () => {
try {
await adapter.continueConversation(conversationReference, async turnContext => {
await turnContext.sendActivity('Are you still there?');
});
}
catch (error) {
console.log(error);
}
}, 8000,conversationReference);
After doing some research online, i have added additional parameters like claims identity and Root Bot's App Id as below but now I receive error that adapter.continueConversationAsync is not a function
var conversationReference = TurnContext.getConversationReference(stepContext.context.activity);
var claimsIdentity= stepContext.context.turnState.get(stepContext.context.adapter.BotIdentityKey);
var oAuthScope= stepContext.context.turnState.get(stepContext.context.adapter.OAuthScopeKey);
await adapter.continueConversationAsync(claimsIdentity, convRef, oAuthScope, async context => {
await context.sendActivity("hello");
})
Can anyone please help resolve the issue?