How to collect data from button to slot?

See the code below which might be used for HubSpot contact enrichment: responses: utter_greet: - text: “Hello! How can I assist you?” buttons: - title: “Yes” payload: “/button_response{ “button”: “yes” }” - title: “No” payload: “/button_response{ “button”: “no” }”

slots: button_response: type: text

intent button_response

  • /button_response{ “button”: “yes” }
  • /button_response{ “button”: “no” }

Button Response Path

  • greet
    • utter_greet
  • button_response
    • slot{“button_response”: “yes”}
    • utter_acknowledge

class ActionHandleButtonResponse(Action): def name(self): return “action_handle_button_response”

def run(self, dispatcher, tracker, domain):
    button_response = tracker.get_slot("button_response")
    # Perform actions or logic based on button_response value
    # You can access other slots or entities as well if needed
    # Example:
    if button_response == "yes":
        dispatcher.utter_message("Great! You selected Yes.")
    elif button_response == "no":
        dispatcher.utter_message("Okay. You chose No.")
    return []