Adaptive Cards and teams subscription

Ritu 1 Reputation point
2022-06-13T22:43:22.543+00:00

I have a subscription created on Team's channel to receive the notification when there is a new message posted in team's channel. once I received the notification, using message id I am calling graph api to get the details of the message. This is working fine with text message and also with attachment.

Now I have another application which sends a message to teams's channel with adaptive cards as an attachment. the adaptive card has input fields for user to enter the information. my requirement is that on click of button on adaptive card I need to send the message back with the user input data. Is it possible? if yes how can I achieve this.

Thanks!

Microsoft Teams | Development
Microsoft Teams | Microsoft Teams for business | Other
{count} votes

1 answer

Sort by: Most helpful
  1. Ritu 1 Reputation point
    2022-06-15T19:35:37.407+00:00

    @Sayali-MSFT I went thru the message extension document , it says that we need to register our web service as a bot and use Bot Framework SDK.
    my webservice is going to be in salesforce, so can not use SDK.

    I tried passing below JSON to create a message via graph API, when I click on button in card I get notification back in my subscription method.
    I parsed the message Id in subscription method and call graph api to get the message details using message Id, In that details I am not getting the user input data. I am getting the same value in attachment.

    {"body": {"contentType": "html","content": "<at id ='0'>actionhubbot</at> testing the attachment<attachment id=\"DBA3A977-146C-4AF8-9AD8-E38325B2C34A\"></attachment>"},
    "attachments": [
    {
    "id": "DBA3A977-146C-4AF8-9AD8-E38325B2C34A",
    "contentType": "application/vnd.microsoft.card.adaptive",
    "content":"{\n \"type\": \"AdaptiveCard\", \n\"$schema\": \"http://adaptivecards.io/schemas/adaptive-card.json\",\n \"version\": \"1.5\",\"body\": [{ \"type\": \"Input.Text\", \"id\": \"id_text\"}], \"actions\": [{\"type\": \"Action.Submit\", \"title\": \"Click me for messageBack\", \"data\": { \"msTeams\": {\"type\": \"messageBack\",\"displayText\": \"I clicked this button\", \"text\": \"text to bots\",\"value\": {\"bfKey\": \"bfVal\", \"conflictKey\": \"from value\"} }, \"extraData\":{} } }]}"

        }  
    ]  
    

    }

    Do you see any issue in above JSON , In one of the blog I found that we can use msteams object in adaptive cards however couldn't find any document on that. not sure what "value\": {\"bfKey\": \"bfVal\", \"conflictKey\": \"from value\"} } means here, can you please help me to understand


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.