Digital Assistant and Mobile

Get Involved. Join the Conversation.

Topic

    Pawan Gupta
    MS Team ODA is Action.Submit supported with Adaptive CardAnswered
    Topic posted November 12, 2019 by Pawan GuptaBlue Ribbon: 750+ Points, tagged Conversational AI, Virtual Assistant, VPA 
    19 Views, 2 Comments
    Title:
    MS Team ODA is Action.Submit supported with Adaptive Card
    Summary:
    MS Team ODA is Action.Submit supported with Adaptive Card
    Content:
    Trying to make Action.Submit work in MS Adaptive card, appreciate if anyone can help with documentation or sample how ODA would receive the messafe back.

    Best Comment

    Steven Davelaar

    You define the payload submitted to bots runtime engine using the data property of the submit action. If you want the CRC component to transition after pressing the button and/or set some variables, you can use the standard action and variables properties:

    actions:
    - type: "Action.Submit"
      title: "Order"
      data: 
        action: "order" 
        variables:
          orderedPizza: "${pizzas.name}"
          orderedPizzaImage: "${pizzas.image}"
     

    If you are using input fields in your card, the name and value of these fields will be added as key-value pairs to the data JSON object.

    For example you can create an Edit Expense card, including 3 fields to modify the expense type, amount and date. When the user taps the Submit button in this case, a JSON Object like the following will be sent to the bots runtime:

     

    {
      "Type" "Taxi",
      "Amount" "10.0 dollar"
      "Date" "2019-09-02"
    }
     

    The CRC component does not know how to process this information, as it does not follow the common payload structure with action and variables properties. To solve this, you have two options:

    1. Convert the JSON payload to a string, which will then be matched for entities, and if any matches found, the variable set with the CRC component will be updated with the corresponding entity value, or entity values (in case of a composite bag entity). 
    2. Instruct the bots runtime to update variables by the same name as the input fields. In the above example, the context variables named "Type", "Amount" and "Date" would be updated.

    To configure option 1, you add the boolean system.convertToString property to the data property of the submit action:

    actions:
     
    - type: Action.Submit
      title: Submit
      id: submit                   
      data:
        system.convertToString: true
     
    To configure option 2, you add the boolean system.setVariables property to the data property of the submit action:
    actions:
    - type: Action.Submit
      title: Submit
      id: submit                   
      data:
        system.setVariables: true
     

    If you don't configure any of these options, the submitted values will simply be ignored.

    When using CRC with a composite bag entity, you will typically use option 1, which will populate all the matched entities in the bag based on the stringified JSON payload.

    NOTE: You need to set the CRC processUserMessage property to true for these submit actions to work.

     

    Hope this helps,

    Steven Davelaar,

    Oracle A-Team.

     

    Comment

     

    • Steven Davelaar

      You define the payload submitted to bots runtime engine using the data property of the submit action. If you want the CRC component to transition after pressing the button and/or set some variables, you can use the standard action and variables properties:

      actions:
      - type: "Action.Submit"
        title: "Order"
        data: 
          action: "order" 
          variables:
            orderedPizza: "${pizzas.name}"
            orderedPizzaImage: "${pizzas.image}"
       

      If you are using input fields in your card, the name and value of these fields will be added as key-value pairs to the data JSON object.

      For example you can create an Edit Expense card, including 3 fields to modify the expense type, amount and date. When the user taps the Submit button in this case, a JSON Object like the following will be sent to the bots runtime:

       

      {
        "Type" "Taxi",
        "Amount" "10.0 dollar"
        "Date" "2019-09-02"
      }
       

      The CRC component does not know how to process this information, as it does not follow the common payload structure with action and variables properties. To solve this, you have two options:

      1. Convert the JSON payload to a string, which will then be matched for entities, and if any matches found, the variable set with the CRC component will be updated with the corresponding entity value, or entity values (in case of a composite bag entity). 
      2. Instruct the bots runtime to update variables by the same name as the input fields. In the above example, the context variables named "Type", "Amount" and "Date" would be updated.

      To configure option 1, you add the boolean system.convertToString property to the data property of the submit action:

      actions:
       
      - type: Action.Submit
        title: Submit
        id: submit                   
        data:
          system.convertToString: true
       
      To configure option 2, you add the boolean system.setVariables property to the data property of the submit action:
      actions:
      - type: Action.Submit
        title: Submit
        id: submit                   
        data:
          system.setVariables: true
       

      If you don't configure any of these options, the submitted values will simply be ignored.

      When using CRC with a composite bag entity, you will typically use option 1, which will populate all the matched entities in the bag based on the stringified JSON payload.

      NOTE: You need to set the CRC processUserMessage property to true for these submit actions to work.

       

      Hope this helps,

      Steven Davelaar,

      Oracle A-Team.

       
    • Patrick Keegan

      The official docs are now updated with info on incorporating Adaptive Cards in ODA skills: https://docs.oracle.com/en/cloud/paas/digital-assistant/use-chatbot/microsoft-teams.html#GUID-4D992EA3-1092-4EAA-A741-DE4B34372F46