# How to get user entered text in custom action

**URL:** <https://forum.rasa.com/t/how-to-get-user-entered-text-in-custom-action/640>\
**Category:** Rasa Open Source\
**Created:** [August 24, 2018, 6:06am UTC](https://forum.rasa.com/t/how-to-get-user-entered-text-in-custom-action/640 "2018-08-24T06:06:15Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![raghavendrav1210](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/raghavendrav1210/32/2235_2.png) [@raghavendrav1210](https://forum.rasa.com/u/raghavendrav1210)\
**Post date:** [August 24, 2018, 6:06am UTC](https://forum.rasa.com/t/how-to-get-user-entered-text-in-custom-action/640/1 "2018-08-24T06:06:16Z")

</div>

HI All,

I am trying to get the user entered text inside run method of a custom action. In which object I can get that

```auto
def run(self, dispatcher, tracker, domain):

```

---

<div class="post-metadata">

**Author:** ![akelad](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/akelad/32/69_2.png) [@akelad](https://forum.rasa.com/u/akelad)\
**Post date:** [August 24, 2018, 12:49pm UTC](https://forum.rasa.com/t/how-to-get-user-entered-text-in-custom-action/640/2 "2018-08-24T12:49:08Z")

</div>

You can get this with `tracker.latest_message.text`

---

<div class="post-metadata">

**Author:** ![raghavendrav1210](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/raghavendrav1210/32/2235_2.png) [@raghavendrav1210](https://forum.rasa.com/u/raghavendrav1210)\
**Post date:** [August 24, 2018, 12:50pm UTC](https://forum.rasa.com/t/how-to-get-user-entered-text-in-custom-action/640/3 "2018-08-24T12:50:14Z")

</div>

Got it thanks 🙂

---

<div class="post-metadata">

**Author:** ![raghavendrav1210](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/raghavendrav1210/32/2235_2.png) [@raghavendrav1210](https://forum.rasa.com/u/raghavendrav1210)\
**Post date:** [August 24, 2018, 12:52pm UTC](https://forum.rasa.com/t/how-to-get-user-entered-text-in-custom-action/640/4 "2018-08-24T12:52:32Z")

</div>

@akelad thanks for your answer. i have one more question how can I run multiple projects in a rasa core server instance.

I mean I have a FAQ Bot and Helpdesk bot How to run these at a time and how can I call them using REST API?

---

<div class="post-metadata">

**Author:** ![bhaarat](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/bhaarat/32/464_2.png) [@bhaarat](https://forum.rasa.com/u/bhaarat)\
**Post date:** [September 20, 2018, 6:38pm UTC](https://forum.rasa.com/t/how-to-get-user-entered-text-in-custom-action/640/6 "2018-09-20T18:38:15Z")

</div>

I am trying to do that but no success yet. I get the error as below:

> rasa\_core.actions.action - Failed to run custom action ‘action\_help’. Action server responded with a non 200 status code of 500. Make sure your action server properly runs actions and returns a 200 once the action is executed. Error: 500 Server Error: INTERNAL SERVER ERROR for url: [http://localhost:5055/webhook](http://localhost:5055/webhook) ERROR rasa\_core.processor - Encountered an exception while running action ‘action\_help’. Bot will continue, but the actions events are lost. Make sure to fix the exception in your custom code. ERROR rasa\_core.processor - Failed to execute custom action. in my actions.py I have this line of code below: `dispatcher.utter_message(tracker.latest_message.entities(help))` As soon as I remove this line of code everything works as it should. The precise error I get is: `AttributeError: 'dict' object has no attribute 'entities'` Any help on this.

Thanks

---

<div class="post-metadata">

**Author:** ![ashukrishna100](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/ashukrishna100/32/516_2.png) [@ashukrishna100](https://forum.rasa.com/u/ashukrishna100)\
**Post date:** [September 26, 2018, 3:00pm UTC](https://forum.rasa.com/t/how-to-get-user-entered-text-in-custom-action/640/7 "2018-09-26T15:00:14Z")

</div>

For version 11.0 and above Use this

> ` (tracker.latest_message)['text']`

This is for version 0.10 and lower `tracker.latest_message.text`

---

<div class="post-metadata">

**Author:** ![bhaarat](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/bhaarat/32/464_2.png) [@bhaarat](https://forum.rasa.com/u/bhaarat)\
**Post date:** [September 26, 2018, 4:18pm UTC](https://forum.rasa.com/t/how-to-get-user-entered-text-in-custom-action/640/8 "2018-09-26T16:18:37Z")

</div>

Thanks for the reply. It worked for me.

---

<div class="post-metadata">

**Author:** ![Ajinkz](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/ajinkz/32/757_2.png) [@Ajinkz](https://forum.rasa.com/u/Ajinkz)\
**Post date:** [January 8, 2019, 6:43am UTC](https://forum.rasa.com/t/how-to-get-user-entered-text-in-custom-action/640/9 "2019-01-08T06:43:58Z")

</div>

I m trying to print only those user input which bot cant interpret using following code

```
txt=tracker.latest_message.text
return txt

```

Now getting this error

```
AttributeError: 'dict' object has no attribute 'text'

```

My ultimate task is to add those input which are not present in training data under some intent like unknown user input

---

<div class="post-metadata">

**Author:** ![srikar\_1996](https://avatars.discourse-cdn.com/v4/letter/s/e274bd/32.png) [@srikar\_1996](https://forum.rasa.com/u/srikar_1996)\
**Post date:** [January 8, 2019, 7:11am UTC](https://forum.rasa.com/t/how-to-get-user-entered-text-in-custom-action/640/10 "2019-01-08T07:11:16Z")

</div>

Try it this way

```auto
message = tracker.latest_message.get('text')

```

---

<div class="post-metadata">

**Author:** ![Ajinkz](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/ajinkz/32/757_2.png) [@Ajinkz](https://forum.rasa.com/u/Ajinkz)\
**Post date:** [January 8, 2019, 8:41am UTC](https://forum.rasa.com/t/how-to-get-user-entered-text-in-custom-action/640/11 "2019-01-08T08:41:00Z")

</div>

Thanks. Its working.

---

<div class="post-metadata">

**Author:** ![lohith.arcot](https://avatars.discourse-cdn.com/v4/letter/l/ce7236/32.png) [@lohith.arcot](https://forum.rasa.com/u/lohith.arcot)\
**Post date:** [September 6, 2019, 4:21am UTC](https://forum.rasa.com/t/how-to-get-user-entered-text-in-custom-action/640/12 "2019-09-06T04:21:11Z")

</div>

thanks

---

<div class="post-metadata">

**Author:** ![jeng](https://avatars.discourse-cdn.com/v4/letter/j/51bf81/32.png) [@jeng](https://forum.rasa.com/u/jeng)\
**Post date:** [November 27, 2019, 1:17am UTC](https://forum.rasa.com/t/how-to-get-user-entered-text-in-custom-action/640/13 "2019-11-27T01:17:06Z")

</div>

hi, may i know how and where you add in those code for tracking user input?

---

<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, 8:48pm UTC](https://forum.rasa.com/t/how-to-get-user-entered-text-in-custom-action/640/14 "2019-11-27T20:48:37Z")

</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

---

<div class="post-metadata">

**Author:** ![Edukondalu](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/edukondalu/32/11843_2.png) [@Edukondalu](https://forum.rasa.com/u/Edukondalu)\
**Post date:** [May 6, 2020, 4:26am UTC](https://forum.rasa.com/t/how-to-get-user-entered-text-in-custom-action/640/15 "2020-05-06T04:26:04Z")

</div>

if i have form action … it is taking latest message of form field of text value. but need a user question.

input\_str = tracker.latest\_message.get(“text”)  
it is taking form field values if form fields are manually text field format. so how can i get the input str as user query.

---

<div class="post-metadata">

**Author:** ![SumanthLazarus](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/sumanthlazarus/32/10388_2.png) [@SumanthLazarus](https://forum.rasa.com/u/SumanthLazarus)\
**Post date:** [August 5, 2020, 7:36pm UTC](https://forum.rasa.com/t/how-to-get-user-entered-text-in-custom-action/640/16 "2020-08-05T19:36:34Z")

</div>

In order to extract the _name_, one way to go about it is create an intent **get\_name** with entity **name** ; you can feed training data which demonstrates response to needed question.

eg:

```
## intent: get_name
    - My name is [Karthik](name)
    - My name is [possible](name)
    - My name is [other names](name)
    - I am [Sumanth](name)
    - I am [William](name)
    - I am [Lazarus](name)
```

---

<div class="post-metadata">

**Author:** ![thundersparkf](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/thundersparkf/32/10360_2.png) [@thundersparkf](https://forum.rasa.com/u/thundersparkf)\
**Post date:** [August 29, 2020, 2:07pm UTC](https://forum.rasa.com/t/how-to-get-user-entered-text-in-custom-action/640/17 "2020-08-29T14:07:04Z")

</div>

hey, I have tried this but it isn’t working. I have also tried the tracker.latest\_message.text. I’m using the rasa/rasa-sdk:2.0.0x docker image and I had it working previously, now it’s not working. The custom action is just running completely ignoring the latest text thing. Please help, Thank you!

---

<div class="post-metadata">

**Author:** ![athenasaurav](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/athenasaurav/32/8139_2.png) [@athenasaurav](https://forum.rasa.com/u/athenasaurav)\
**Post date:** [September 4, 2020, 12:01pm UTC](https://forum.rasa.com/t/how-to-get-user-entered-text-in-custom-action/640/18 "2020-09-04T12:01:35Z")

</div>

Hi @thundersparkf

The code is

```auto
tracker.latest_message.get('text')

```

---

<div class="post-metadata">

**Author:** ![RahulJha393](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/rahuljha393/32/22358_2.png) [@RahulJha393](https://forum.rasa.com/u/RahulJha393)\
**Post date:** [February 1, 2023, 6:04am UTC](https://forum.rasa.com/t/how-to-get-user-entered-text-in-custom-action/640/19 "2023-02-01T06:04:48Z")

</div>

> [@akelad](#):
>
> tracker.latest\_message.text

This will work in action :

tracker.latest\_message[‘text’]
