OfficeDev / teams-toolkit

Developer tools for building Teams apps
Other
460 stars 189 forks source link

Sending proactive message example fails (+fix) #12206

Open roeeoz opened 2 months ago

roeeoz commented 2 months ago

This line fails with both in test tools and in Azure due to process.env.MicrosoftAppId being undefined

//await adapter.continueConversationAsync(process.env.MicrosoftAppId, confRef, async (context) => {

Changing to this line works at least on local. await adapter.continueConversationAsync( new ClaimsIdentity([], true), confRef, async (context) => { await context.sendActivity("proactive hello"); } );

Does this fix makes sense? Or do I need to change something else?

roee.oz<>microsoft.com

microsoft-github-policy-service[bot] commented 2 months ago

Thank you for contacting us! Any issue or feedback from you is quite important to us. We will do our best to fully respond to your issue as soon as possible. Sometimes additional investigations may be needed, we will usually get back to you within 2 days by adding comments to this issue. Please stay tuned.

roeeoz commented 2 months ago

Debugged it also on remote.

I think the error comes from this code base: https://github.com/microsoft/BotBuilder-Samples/blob/main/samples/typescript_nodejs/16.proactive-messages/src/index.ts

Should use either config.MicrosoftAppId, or process.env.BOT_ID not process.env.MicrosoftAppId as the code does.

Anyway this line worked both after deploy and locally:

await adapter.continueConversationAsync( config.MicrosoftAppId || new ClaimsIdentity([], true), confRef, async (context) => { await context.sendActivity("proactive hello"); recipients.push(JSON.stringify(confRef)); } );