Forum Discussion

ray2408's avatar
ray2408
Brass Contributor
Apr 12, 2024

Pass adaptive card meta data to handleTeamsTaskModuleFetch method.

Hi, 
I want to know how to pass metadata of adaptive card to 

handleTeamsTaskModuleFetch function, so I can have this data in the dialog.
metaData is huge data in my case.
  • Hi ray2408 - Thanks for raising the query.
    We will look into it and let you know the updates.
  • Hi ray2408,

    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

Resources