How to add entity : phone-number under stories?

I want to run a custom action inside story which should ask phone-number from user and then perform action.

  • The entity is phone-number (Duckling dimension with no intent).
  • Phone-number is a part of a form which contains 4 others entities however, while searching for record it is supposed to ask only “phone-number”.
  • Since I don’t have an intent, how should I ask for the same in the story?
- story: Modify appointment
    - intent: modify_appointment
    - action: utter_ask_phone-number
    - intent: ?
      - phone-number:'6912399123'
    - action: action_search_data
class ActionSearchData(Action):

    def name(self) -> Text:
        return "action_search_data"

    def search_phone(self,
            dispatcher: CollectingDispatcher, 
            tracker: Tracker,
            domain: Dict[Text, Any],
        ) -> Dict[Text, Any]:

        phone = tracker.get_slot("phone-number")
        print(f"Contact number given = {phone}")

I understand you’re looking for an intent in which the user gives their phone number?

You could create an intent called inform_phone_number with examples like any other intent.

You could also create an intent called inform with examples like any other intent, but you can use it for things other than phone numbers as well. For example:

- intent: inform
  examples: |
  - My name is [Chris](name)
  - You can call me [Deepali](name)
  - My phone number is [6912399123](phone_number)
  - Call me at [6945633567](phone_number)
  - I live in [Lebanon](location)
  - I'm from [Switzerland](location)

@ChrisRahme thank you!!

1 Like