# Rasa action,py get specific bot utterance text programmatically

**URL:** <https://forum.rasa.com/t/rasa-action-py-get-specific-bot-utterance-text-programmatically/44772>\
**Category:** Rasa Open Source\
**Created:** [June 17, 2021, 8:28pm UTC](https://forum.rasa.com/t/rasa-action-py-get-specific-bot-utterance-text-programmatically/44772 "2021-06-17T20:28:52Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![LaurentStar](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/laurentstar/32/13884_2.png) [@LaurentStar](https://forum.rasa.com/u/LaurentStar)\
**Post date:** [June 17, 2021, 8:28pm UTC](https://forum.rasa.com/t/rasa-action-py-get-specific-bot-utterance-text-programmatically/44772/1 "2021-06-17T20:28:52Z")

</div>

Hello, I need to get one of my bot utterances specified in the domain file programmatically. How would I do this?

---

<div class="post-metadata">

**Author:** ![tuhinsom](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/tuhinsom/32/15336_2.png) [@tuhinsom](https://forum.rasa.com/u/tuhinsom)\
**Post date:** [June 18, 2021, 7:41am UTC](https://forum.rasa.com/t/rasa-action-py-get-specific-bot-utterance-text-programmatically/44772/2 "2021-06-18T07:41:52Z")

</div>

Try this,

In domain:

responses: utter\_greet\_name:

- text: Hi {name}!

in action:

```auto
dispatcher.utter_message(template = "utter_greet_name", name = "Aimee")

```

or

```auto
dispatcher.utter_template("utter_greet_name", tracker, name = "Aimee")

```

---

<div class="post-metadata">

**Author:** ![LaurentStar](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/laurentstar/32/13884_2.png) [@LaurentStar](https://forum.rasa.com/u/LaurentStar)\
**Post date:** [June 18, 2021, 4:10pm UTC](https://forum.rasa.com/t/rasa-action-py-get-specific-bot-utterance-text-programmatically/44772/3 "2021-06-18T16:10:35Z")

</div>

Does this only display text or does it get me the string I can manage through python. I may need to get more than one

---

<div class="post-metadata">

**Author:** ![nik202](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/nik202/32/16098_2.png) [@nik202](https://forum.rasa.com/u/nik202)\
**Post date:** [June 18, 2021, 8:16pm UTC](https://forum.rasa.com/t/rasa-action-py-get-specific-bot-utterance-text-programmatically/44772/4 "2021-06-18T20:16:24Z")

</div>

@LaurentStar

**domain.yml**

responses: utter\_show\_detail:

- text: Thanks **{name}!** for the Email id **{email}**. How can I help you!

actions: action\_show\_detail

**action.py**

class ActionDetailt(Action):

```
 def name(self) -> Text:
     return "action_show_detail"

 def run(self, dispatcher: CollectingDispatcher,
         tracker: Tracker,
         domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
        
     name=tracker.get_slot("name")
     email=tracker.get_slot("email")

     dispatcher.utter_message(template="utter_show_detail")
     
     return []

```

You need to create the intent in nlu.yml, mention the Intent, Entities, Slots in domain.yml and create the story for the bot/user conversation.

You need to think now 😉 I know you can do this. I can’t post the complete code. Good luck. Do share the screenshot with us! Happy learning.

---

<div class="post-metadata">

**Author:** ![LaurentStar](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/laurentstar/32/13884_2.png) [@LaurentStar](https://forum.rasa.com/u/LaurentStar)\
**Post date:** [June 21, 2021, 4:58pm UTC](https://forum.rasa.com/t/rasa-action-py-get-specific-bot-utterance-text-programmatically/44772/5 "2021-06-21T16:58:23Z")

</div>

😒

I checked the documentation. dispatcher.utter\_message method does not return anything. None of the methods return anything. I don’t want to display a specific message, I want the string. If it can’t be done/ or shouldn’t be done just say so

---

<div class="post-metadata">

**Author:** ![nik202](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/nik202/32/16098_2.png) [@nik202](https://forum.rasa.com/u/nik202)\
**Post date:** [June 21, 2021, 5:08pm UTC](https://forum.rasa.com/t/rasa-action-py-get-specific-bot-utterance-text-programmatically/44772/6 "2021-06-21T17:08:32Z")

</div>

@LaurentStar The process or code I shared with you should be done. There is no other method in my knowledge. For me, the above method fulfills the requirement which you want, try to follow [Rasa · GitHub](https://github.com/RasaHQ) and see the examples. Hope it will help you more. Good Luck!
