This is my story
# Balance_single_account
* greet
- utter_greet
* balance_enquiry
- action_fetch_profile
- slot{"account_type" : "multi_acc"}
- form{"name": "balance_enq_form"}
- form{"name": null}
this is required response
utter_ask_accLast4Digits:
- text: "Multiple accounts found \n Enter last 4 digits of your account number"
this is my balance form action
class BalanceForm(FormAction):
"""Custom form action to fill all slots required to find specific type
of healthcare facilities in a certain city or zip code."""
def name(self) -> Text:
"""Unique identifier of the form"""
return "balance_enq_form"
@staticmethod
def required_slots(tracker: Tracker) -> List[Text]:
"""A list of required slots that the form has to fill"""
account_type = tracker.get_slot('account_type')
if account_type =="multi_acc":
return ["accLast4Digits"]
else:
return []
# def slot_mappings(self) -> Dict[Text, Any]:
# return {"facility_type": self.from_entity(entity="facility_type",
# intent=["inform",
# "search_provider"]),
# "location": self.from_entity(entity="location",
# intent=["inform",
# "search_provider"])}
def submit(self,
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any]
) -> List[Dict]:
"""Once required slots are filled, print buttons for found facilities"""
accLast4Digits = tracker.get_slot('accLast4Digits')
[FinalAccountNumber,
FinalCIFNumber] = accnum_by_mobile(mobile_number, False,
accLast4Digits)
if FinalAccountNumber == '':
dispatcher.utter_message("Incorrect account number.\\n \\nPlease enter the last 4 digit of your account for verification. \\n \\n")
else:
balance = balance_api_call(FinalAccountNumber)
dispatcher.utter_message(f'''Your avaliable balance is {balance}''')
return []
when i do this request after greeting message to this rest url : http://XXXXXX:100/webhooks/rest/webhook {“message”:“bal”,“sender”:“917587XXX023”}
response is
[]
expected :
{
"text": "Multiple accounts found \n Enter last 4 digits of your account number",
"sender_id":"917587XXX023"
}
i could get this without form actions… facing issue when using forms
that mobile number is having multi accounts … that is already known but still i am getting null respose from the balance enquiry form
Elaborating what is the expected to happen
As that mobile number is having multiple accounts and i havent set an slot map in my BalanceForm(FormAction) code … so the only unfilled slot is accLast4Digits
so for this slot to be filled accorfing to docs i have written a template response named utter_ask_accLast4Digits in the domain file… i expect to utter Multiple accounts found \n Enter last 4 digits of your account number this message and user fills that slot by entering and action goes to submit part as all the slots are filled… But i am not getting any message related to utter_ask_accLast4Digits this.
what would be possible issue ?