Multiple yes/no questions in a form

I am attempting to create a form that asks a user multiple yes/no questions like “can I send you a text” or “can I send you an email”. The slots for can_send_sms and can_send_email have the same format and are set to be boolean values using the from_intent tag. Since both slots use the same affirm and deny intents, they are both set at the same time.

Is there a way to only set one of these slots at a time? Is there a better way of doing what I am trying to do?

domain.yml

slots:
  can_send_sms:
    type: bool
    mappings:
      - type: from_intent
        value: true
        intent: affirm
      - type: from_intent
        value: false
        intent: deny
  can_send_email:
    type: bool
    mappings:
      - type: from_intent
        value: true
        intent: affirm
      - type: from_intent
        value: false
        intent: deny

forms:
  my_form:
    required_slots:
      - can_send_sms
      - can_send_email

rules.yml

  - rule: Activate Form
    steps:
      - intent: intent_start_form
      - action: my_form
      - active_loop: my_form
1 Like

Figured it out by using mapping conditions for the slots: Domain

1 Like
slots:
  can_send_sms:
    type: bool
    mappings:
      - type: from_intent
        value: true
        intent: affirm
        - conditions:
           - active_loop: my_form
             requested_slot: can_send_sms
      - type: from_intent
        value: false
        intent: deny
        - conditions:
           - active_loop: my_form
             requested_slot: can_send_sms

  can_send_email:
    type: bool
    mappings:
      - type: from_intent
        value: true
        intent: affirm
        - conditions:
           - active_loop: my_form
             requested_slot: can_send_email
      - type: from_intent
        value: false
        intent: deny
        - conditions:
           - active_loop: my_form
             requested_slot: can_send_email

2 Likes

This worked for me. Thank you @wlu07