How to use the adaptive metadata

Copper Contributor

I want to use adaptive metadata store some data in teams bot, and get the data in 

handleTeamsTaskModuleFetch() when I click the button in the adaptive card. Is it possible?
 
If not, can anybody please give an example how to use the adaptive metadata correctly. 
6 Replies

Hi @Jason1395 - Thanks for raising the query.
We will look into it and let you know the updates.

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 data object from Action.Submit and returns it as the payload of the task/submit event.

 

In your adaptive card JSON, include an Action.Submit action and place the metadata you want to pass within the data property of the action.In your bot's code, implement the handleTeamsTaskModuleFetch function. This function will be called when the user interacts with the adaptive card. Within the handleTeamsTaskModuleFetch function, you can access the metadata sent from the adaptive card by reading the taskModuleRequest.data property. 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

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.

@Dinesh-MSFT  any update on this

Hi @ray2408 - We are checking this issue internally. We get back to you. 

@Dinesh-MSFT Any update on this?