# How to get user name and password through custom action

**URL:** <https://forum.rasa.com/t/how-to-get-user-name-and-password-through-custom-action/13195>\
**Category:** Rasa Open Source\
**Created:** [July 19, 2019, 7:50pm UTC](https://forum.rasa.com/t/how-to-get-user-name-and-password-through-custom-action/13195 "2019-07-19T19:50:07Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![surya1994](https://avatars.discourse-cdn.com/v4/letter/s/b9e5f3/32.png) [@surya1994](https://forum.rasa.com/u/surya1994)\
**Post date:** [July 19, 2019, 7:50pm UTC](https://forum.rasa.com/t/how-to-get-user-name-and-password-through-custom-action/13195/1 "2019-07-19T19:50:07Z")

</div>

Hi

I am doing a project in which i have to login through chat bot using username and password(it should not visible) so here i cannot defined username and password in nlu data as we have different formats of user name and password.so i decided to take username and password through custom action but through custom action i am not able to set these slots and it directly goes to next action with out setting username and password slots

i even try form action but here also the slots are getting set only if we mention username and password examples in nlu data

My purpose is to get username and password(while typing it should not visible) with out nlu data and store it in slots and use these values for calling api

can any one please help me with this it is urgent

Thanks in advance

---

<div class="post-metadata">

**Author:** ![surya1994](https://avatars.discourse-cdn.com/v4/letter/s/b9e5f3/32.png) [@surya1994](https://forum.rasa.com/u/surya1994)\
**Post date:** [July 20, 2019, 6:10am UTC](https://forum.rasa.com/t/how-to-get-user-name-and-password-through-custom-action/13195/2 "2019-07-20T06:10:39Z")

</div>

can any one please help me with this

---

<div class="post-metadata">

**Author:** ![prashant\_kamble](https://avatars.discourse-cdn.com/v4/letter/p/df705f/32.png) [@prashant\_kamble](https://forum.rasa.com/u/prashant_kamble)\
**Post date:** [July 20, 2019, 6:56am UTC](https://forum.rasa.com/t/how-to-get-user-name-and-password-through-custom-action/13195/3 "2019-07-20T06:56:48Z")

</div>

Hi @surya1994,

I think that we will need to give some nlu data for the username and password data pattern. I have also came across same situation I also tried, but it’s same at my side. I am also trying to achieve this but for the time being I havn’t got anything.

Unless you will need to provide some data to work it out. Even I also tryied to achieve this using regular expressions but even it’s not working.

At the end it requires data of that particular type. Let’s see reply from other memebers.

---

<div class="post-metadata">

**Author:** ![surya1994](https://avatars.discourse-cdn.com/v4/letter/s/b9e5f3/32.png) [@surya1994](https://forum.rasa.com/u/surya1994)\
**Post date:** [July 20, 2019, 11:37am UTC](https://forum.rasa.com/t/how-to-get-user-name-and-password-through-custom-action/13195/4 "2019-07-20T11:37:13Z")

</div>

Hi prashant\_kamble

But even if we provide training data also there might be some cases in which both user name and password follows similar pattern and same length (because we cannot predict user he may give any pattern) if this is the case nlu might predict username as password and password as username which is wrong how can we over come this case if you know anything please let me know

---

<div class="post-metadata">

**Author:** ![msamogh](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/msamogh/32/3478_2.png) [@msamogh](https://forum.rasa.com/u/msamogh)\
**Post date:** [July 21, 2019, 4:44pm UTC](https://forum.rasa.com/t/how-to-get-user-name-and-password-through-custom-action/13195/5 "2019-07-21T16:44:29Z")

</div>

@surya1994 How are you trying to set the slots in your custom action? If you’re trying to set the slot value to equal the whole text of the user input inside a custom action, it should work fine.

Also, just to confirm, you’re asking something like “Enter your username” and the user enters _just_ the username (with no extra frills like “My username is …”), right?

---

<div class="post-metadata">

**Author:** ![surya1994](https://avatars.discourse-cdn.com/v4/letter/s/b9e5f3/32.png) [@surya1994](https://forum.rasa.com/u/surya1994)\
**Post date:** [July 21, 2019, 6:49pm UTC](https://forum.rasa.com/t/how-to-get-user-name-and-password-through-custom-action/13195/6 "2019-07-21T18:49:17Z")

</div>

I did not get your first point can you explain in detail

Yes for 2 nd case user will enter only username with no extra frills like My username is

---

<div class="post-metadata">

**Author:** ![msamogh](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/msamogh/32/3478_2.png) [@msamogh](https://forum.rasa.com/u/msamogh)\
**Post date:** [July 22, 2019, 3:29pm UTC](https://forum.rasa.com/t/how-to-get-user-name-and-password-through-custom-action/13195/7 "2019-07-22T15:29:23Z")

</div>

Are you using setting your slot value to `tracker.latest_message.text` inside the `run` method of your custom action or something else?

---

<div class="post-metadata">

**Author:** ![surya1994](https://avatars.discourse-cdn.com/v4/letter/s/b9e5f3/32.png) [@surya1994](https://forum.rasa.com/u/surya1994)\
**Post date:** [July 23, 2019, 8:19pm UTC](https://forum.rasa.com/t/how-to-get-user-name-and-password-through-custom-action/13195/8 "2019-07-23T20:19:11Z")

</div>

Yes i am using tracker.latest\_message.text in my custom action but some times i am facing with following error :

Traceback (most recent call last): File “/u01/app/anaconda3/envs/rasa/lib/python3.6/site-packages/rasa/core/actions/action.py”, line 397, in run json=json\_body, method=“post”, timeout=DEFAULT\_REQUEST\_TIMEOUT File “/u01/app/anaconda3/envs/rasa/lib/python3.6/asyncio/coroutines.py”, line 110, in **next** return self.gen.send(None) File “/u01/app/anaconda3/envs/rasa/lib/python3.6/site-packages/rasa/utils/endpoints.py”, line 142, in request resp.status, resp.reason, await resp.content.read() rasa.utils.endpoints.ClientResponseError: 500, INTERNAL SERVER ERROR, body=‘b’\n500 Internal Server Error\n

# Internal Server Error
\n

The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.

\n’’

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File “/u01/app/anaconda3/envs/rasa/lib/python3.6/site-packages/rasa/core/processor.py”, line 439, in \_run\_action events = await action.run(output\_channel, nlg, tracker, self.domain) File “/u01/app/anaconda3/envs/rasa/lib/python3.6/asyncio/coroutines.py”, line 110, in **next** return self.gen.send(None) File “/u01/app/anaconda3/envs/rasa/lib/python3.6/site-packages/rasa/core/actions/action.py”, line 419, in run

core: File “/u01/app/anaconda3/envs/rasa/lib/python3.6/site-packages/flask/app.py”, line 2292, in wsgi\_app response = self.full\_dispatch\_request() File “/u01/app/anaconda3/envs/rasa/lib/python3.6/site-packages/flask/app.py”, line 1815, in full\_dispatch\_request rv = self.handle\_user\_exception(e) File “/u01/app/anaconda3/envs/rasa/lib/python3.6/site-packages/flask\_cors/extension.py”, line 161, in wrapped\_function return cors\_after\_request(app.make\_response(f(\*args, \*\*kwargs))) File “/u01/app/anaconda3/envs/rasa/lib/python3.6/site-packages/flask/app.py”, line 1718, in handle\_user\_exception reraise(exc\_type, exc\_value, tb) File “/u01/app/anaconda3/envs/rasa/lib/python3.6/site-packages/flask/\_compat.py”, line 35, in reraise raise value File “/u01/app/anaconda3/envs/rasa/lib/python3.6/site-packages/flask/app.py”, line 1813, in full\_dispatch\_request rv = self.dispatch\_request() File “/u01/app/anaconda3/envs/rasa/lib/python3.6/site-packages/flask/app.py”, line 1799, in dispatch\_request return self.view\_functionsrule.endpoint File “/u01/app/anaconda3/envs/rasa/lib/python3.6/site-packages/flask\_cors/decorator.py”, line 128, in wrapped\_function resp = make\_response(f(\*args, \*\*kwargs)) File “/u01/app/anaconda3/envs/rasa/lib/python3.6/site-packages/rasa\_sdk/endpoint.py”, line 59, in webhook response = executor.run(action\_call) File “/u01/app/anaconda3/envs/rasa/lib/python3.6/site-packages/rasa\_sdk/executor.py”, line 237, in run “No registered Action found for name ‘{}’.”.format(action\_name) Exception: No registered Action found for name ‘action\_custom\_fallback’.

I am of opinion that i am getting this error because some times response time is more than 100000 ms if that is the case can you please let me know how to fix it(can i increase waiting time)

The above story is without forms but when i use forms i am not even able to set form action slots also(username and password) below is a story and actions.py

story:

## Make\_Payment\_with\_Login

- user\_payment\_message

- utter\_message\_login\_credentials
- utter\_yes\_no\_buttons

- affirm

- user\_login\_form
- form{“name”: “user\_login\_form”}
- form{“name”:“null”}
- action\_outstanding\_amount\_preprocess
- action\_outstanding\_amount
- utter\_payment\_message
- utter\_yes\_no\_buttons

- affirm

program: import logging import requests import json from rasa\_sdk import Action from rasa\_sdk.events import SlotSet from rasa\_sdk.events import Restarted from rasa\_sdk.events import UserUtteranceReverted from rasa\_sdk.events import UserUttered from rasa\_sdk.forms import FormAction from rasa\_sdk import Tracker from rasa\_sdk.executor import CollectingDispatcher from typing import Dict, Text, Any, List, Union, Optional

logger = logging.getLogger( **name** )

#Form action logic class UserLoginForm(FormAction): “”“Example of a custom form action”""

```
def name(self):
    """Unique identifier of the form"""

    return "user_login_form"

@staticmethod
def required_slots(tracker: Tracker) -> List[Text]:
    """A list of required slots that the form has to fill"""
    print("required slots")
    return ["user_id","password"]

def slot_mappings(self):
    # type: () -> Dict[Text: Union[Dict, List[Dict]]]
    """A dictionary to map required slots to
        - an extracted entity
        - intent: value pairs
        - a whole message
        or a list of them, where a first match will be picked"""
    print("user_id",user_id)
    print("password",password)
    return {"user_id": [self.from_text()],"password": [self.from_text()]}

def submit(self):
    """Define what the form has to do
        	after all required slots are filled"""
    dispatcher.utter_template("utter_submit", tracker)
    return []

```

can you please let me know what is the reason and solution for this mentioned error

---

<div class="post-metadata">

**Author:** ![lahsuk](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/lahsuk/32/3127_2.png) [@lahsuk](https://forum.rasa.com/u/lahsuk)\
**Post date:** [July 24, 2019, 6:55am UTC](https://forum.rasa.com/t/how-to-get-user-name-and-password-through-custom-action/13195/9 "2019-07-24T06:55:38Z")

</div>

Hi @surya1994,

Maybe this will help: [How to extract username & password entities from text? - #2 by jabberlope](http://forum.rasa.com/t/how-to-extract-username-password-entities-from-text/12803/2)

Hope that helps. 😄

---

<div class="post-metadata">

**Author:** ![surya1994](https://avatars.discourse-cdn.com/v4/letter/s/b9e5f3/32.png) [@surya1994](https://forum.rasa.com/u/surya1994)\
**Post date:** [July 24, 2019, 12:19pm UTC](https://forum.rasa.com/t/how-to-get-user-name-and-password-through-custom-action/13195/10 "2019-07-24T12:19:26Z")

</div>

Thanks @lahsuk can you please let me know why i am getting above mentioned error

---

<div class="post-metadata">

**Author:** ![lahsuk](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/lahsuk/32/3127_2.png) [@lahsuk](https://forum.rasa.com/u/lahsuk)\
**Post date:** [July 26, 2019, 5:25am UTC](https://forum.rasa.com/t/how-to-get-user-name-and-password-through-custom-action/13195/11 "2019-07-26T05:25:33Z")

</div>

@surya1994,

I think you’re getting this error because it is not finding `action_custom_fallback`. Either you have forgotten to add this to domain.yml file or you don’t have an action that matches with this name.

Edit: Oh, and it’d be better if you formatted the error; it’s really hard to read it as it is. (You can format it with ``` three ticks).

---

<div class="post-metadata">

**Author:** ![karthik1](https://avatars.discourse-cdn.com/v4/letter/k/bc8723/32.png) [@karthik1](https://forum.rasa.com/u/karthik1)\
**Post date:** [November 27, 2019, 10:58pm UTC](https://forum.rasa.com/t/how-to-get-user-name-and-password-through-custom-action/13195/12 "2019-11-27T22:58:13Z")

</div>

Hi all,

I want get the username from the chat conversations

example:- bot:- Hi user:- Hi Bot: May i know your name? User: I am Karthik Bot : Thanks for providing details Karthik

Like the above example i have call the user with there name can anybody please help
