Eventi Aziendali

Immagina di chattare con un bot che gestisce gli eventi aziendali. Vuoi comunicare le tue preferenze per i giorni, e il bot ti risponde con un messaggio che contiene quattro opzioni: puoi scegliere almeno un’opzione, con un massimo di tre.

<message to="user@wfp" id="51c9b72c-f2f1-4e8d-927b-33401065cf0f-211610484933107" type="chat">
    <thread>9e036646-48a9-477d-a165-6feaea487c76</thread>
    <body>{
       "arguments": {
            "content": [
              {
                "type": "chat_text",
                "Which days are you available for the next corporate event?"
              }
            ],
            "layout": {
              "location": "in",
              "selectionMode": "multiple",
              "orientation": "vertical"
            },
            "inputData": {
              "choice": {
                "maxSelectable": 3,
                "minSelectable": 1,
                "submit": [
                  {
                    "type": "chat_text",
                    "text": "Submit"
                  }
                ],
                "visibilityAfterSubmit": "block",
                "list": [
                  {
                    "command": "cmd_monday",
                    "content": [
                      {
                        "type": "chat_text",
                        "text": "Monday"
                      }
                    ],
                    "interaction": {
                      "type": "send_message",
                      "content": [
                        {
                          "type": "chat_text",
                          "text": "Monday",
                        }
                      ]
                    }
                  },
                  {
                    "command": "cmd_tuesday",
                    "content": [
                      {
                        "type": "chat_text",
                        "text": "Tuesday"
                      }
                    ],
                    "interaction": {
                      "type": "send_message",
                      "content": [
                        {
                          "type": "chat_text",
                          "text": "Tuesday",
                        }
                      ]
                    }
                  },
                  {
                    "command": "cmd_friday",
                    "content": [
                      {
                        "type": "chat_text",
                        "text": "Friday"
                      }
                    ],
                    "interaction": {
                      "type": "send_message",
                      "content": [
                        {
                          "type": "chat_text",
                          "text": "Friday",
                        }
                      ]
                    }
                  },
                  {
                    "command": "cmd_saturday",
                    "content": [
                      {
                        "type": "chat_text",
                        "text": "Saturday"
                      }
                    ],
                    "interaction": {
                      "type": "send_message",
                      "content": [
                        {
                          "type": "chat_text",
                          "text": "Saturday",
                        }
                      ]
                    }
                  }
                ]
              }
            },
           "data": {
             "apiVersion": 3,
             "appVersion": "0.0.1",
             "os": "android",
             "token": "token",
             "useChatDynamic": true
           }
         },
         "chat_type": "chat",
         "creation_date": "2024-10-14T17:54:40.8070000Z",
         "domain": "chat",
         "identifier": "0b6685ba-7118-4a1d-84ba-138f328ec54e-211610540337024",
         "language": "eng",
         "type": "chat_dynamic",
         "version": "1.0"
       }
    </body>
 </message>

Una volta selezionate le opzioni, il pulsante di invio sarà abilitato e potrà essere premuto; invierà, ad esempio, il seguente messaggio:

<message to="reservationsbot@wfp" id="51c9b72c-f2f1-4e8d-927b-33401065cf0f-211610484933107" type="chat">
    <thread>9e036646-48a9-477d-a165-6feaea487c76</thread>
    <body>{
       "arguments": {
            "selectedChoices": ["cmd_friday", "cmd_saturday"],
            "content": [
              {
                "type": "chat_text",
                "text": "Friday",
              },
              {
                "type": "chat_text",
                "text": "Saturday",
              }
            ],
            "data": {
              "apiVersion": 3,
              "appVersion": "0.0.1",
              "os": "android",
              "token": "token",
              "useChatDynamic": true
            }
         },
         "chat_type": "chat",
         "creation_date": "2024-10-14T17:54:40.8070000Z",
         "domain": "chat",
         "identifier": "0b6685ba-7118-4a1d-84ba-138f328ec54e-211610540337024",
         "language": "eng",
         "type": "chat_dynamic",
         "version": "1.0"
       }
    </body>
 </message>