Forum Discussion
How to use the adaptive metadata
I want to use adaptive metadata store some data in teams bot, and get the data in
7 Replies
- Dinesh-MSFTFormer Employee
Hi Jason1395,
Dialogs with Adaptive Cards work similarly to the HTML or JavaScript case. The major difference is that, because there's no JavaScript when you're using Adaptive Cards, there's no way to call submit(). Instead, Teams takes the
dataobject fromAction.Submitand returns it as the payload of thetask/submitevent.In your adaptive card JSON, include an
Action.Submitaction and place the metadata you want to pass within thedataproperty of the action.In your bot's code, implement thehandleTeamsTaskModuleFetchfunction. This function will be called when the user interacts with the adaptive card. Within thehandleTeamsTaskModuleFetchfunction, you can access the metadata sent from the adaptive card by reading thetaskModuleRequest.dataproperty. Then use the extracted metadata to populate the task module dialog that you want to present to the user.Ref: Use dialogs in Microsoft Teams bots - Teams | Microsoft Learn
- Jason1395Copper Contributor
Hi Dinesh-MSFT ,
Thanks for your reply.
I know this solution. The problem is that the adaptive card size has a limitation, but the data is very large which I want to store in the adaptive card. Which will raise an error "MessageSizeTooBig" when I create the adaptive card with the large data.
So, I want to try metadata ( https://adaptivecards.io/explorer/Metadata.html ). But I do not know how to use it.
- ray2408Brass Contributor
Dinesh-MSFT any update on this
- Dinesh-MSFTFormer Employee
Hi Jason1395 - Thanks for raising the query.
We will look into it and let you know the updates.