Reputation: 72
When I create a bot and send a simple adaptive card to the user as a welcome message, in web chat I see the card just fine, but when I send the same card to Teams the card is never displayed.
I have reverted to using the standard Microsoft flight booking code and it is the same with that code as well, so this leads me to believe there is a more fundamental step I am missing.
I am using .Net core 3.1 on Visual Studio 2019 using C#.
I'm using ngrok to generate a URL which I am using in Azure to connect up my bot. When I test in azure webchat testing it works fine and I see the welcome message and image but when I then set up the bot in teams I do not see the card at all.
All I get is the text I get after the welcome card.
Any ideas why this simple example doesn't work? I have searched for days without any success!
Upvotes: 0
Views: 192
Reputation: 10854
You'll only see the "Welcome" text once ever in Teams - the very first time the bot is installed. In fact, for purely "dev" scenarios, you can end up missing it entirely, like for instance if the bot is running locally like with ngrok (as you mention), and you forget to start the bot but nevertheless install it in Teams, the "MembersAdded" event never reaches your bot.
This is NOT the case in the emulator, because you're able to easily Restart the conversation in the emulator whenever you like. Teams doesn't have this kind of capability.
There are a few options to deal with this, especially if you don't want to start from scratch. You can design the card using App Studio, which has a option to actually "Send" the card using the App Studio bot. Once you're happy, you can migrate it over to your actual project. To see it in context, you can create a "hidden" command, so to speak, to trigger the card being sent by your bot. For instance, you could have your bot look for the incoming message "/welcomecard", and react to that by re-sending the card any time. The command isn't truly "hidden", in that a regular user could invoke it by entering that text, but it's not exactly easily discoverable.
Upvotes: 1