Search code examples
jsonbotframeworkbotsadaptive-cards

imback functionaliy not returning value to the bot


I am trying to show some adaptive card buttons when loading the bot. It is displaying title in the bot. When clicking on title it is returning null to the bot. I want to submit value mentioned in msteams to be submitted.

Code:

{
  "type": "Action.Submit",
  "title": "Click me for imBack",
  "data": {
    "msteams": {
      "type": "imBack",
      "value": "Text to reply in chat"
    }
  }
}

Solution

  • My new blog post may clear up some things about how to use Adaptive Cards with the Bot Framework: https://blog.botframework.com/2019/07/02/using-adaptive-cards-with-the-microsoft-bot-framework/

    Of particular interest should be the Submit Actions section. You can see that your submit action's data has to be a string in order to trigger the imBack behavior. Your action could look like this:

    {
      "type": "Action.Submit",
      "title": "Click me for imBack",
      "data": "Text to reply in chat"
    }
    

    This will only work if you don't have any input fields in your card. If you want to have both input fields and imBack submit actions, use multiple cards.