# Trouble accessing slot data in basic scenario

**URL:** <https://forum.rasa.com/t/trouble-accessing-slot-data-in-basic-scenario/35700>\
**Category:** Getting Started with Rasa\
**Created:** [October 10, 2020, 5:50am UTC](https://forum.rasa.com/t/trouble-accessing-slot-data-in-basic-scenario/35700 "2020-10-10T05:50:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nmill](https://avatars.discourse-cdn.com/v4/letter/n/e79b87/32.png) [@nmill](https://forum.rasa.com/u/nmill)\
**Post date:** [October 10, 2020, 5:50am UTC](https://forum.rasa.com/t/trouble-accessing-slot-data-in-basic-scenario/35700/1 "2020-10-10T05:50:52Z")

</div>

I’m using Rasa v1.8 and my conversation is like the below. I want to give rasa the `waypoint_name` “alpha” and to store that into a string to be used in the bot’s response. However, the bot says ‘None’ when it should say ‘alpha’. I have the slot `waypoint_name` setup as text.

```
Your input -> I want to save this location
Do you want to save this location?
Your input -> yes
What name do you want to give this location?
Your input -> alpha
Done with saving None
Done with saving None
Your input ->      

```

I only have one story:

```
## save waypoint confirmation 1
* waypoint_desire_save
  - utter_waypoint_confirm_save
* affirm
  - utter_waypoint_request_name
* waypoint_save{"waypoint_name": "alpha"}
  - slot{"waypoint_name": "alpha"}
  - action_set_waypoint
  - utter_waypoint_save_response
* thanks
  - utter_you_are_welcome

```

And my action.py is like this:

```
class ActionSetWaypoint(Action):
    def name(self) -> Text:
        return "action_set_waypoint"

    @staticmethod
    def required_slots(tracker):
        return ["waypoint_name"]

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

        waypoint_name= tracker.get_slot('waypoint_name')
        dispatcher.utter_message(text="Done with saving " + str(waypoint_name))

        return [SlotSet("result", "successful")]

```

My intents for `waypoint_save` are setup like this:

```
## intent:waypoint_save
- save this place as (alpha)[waypoint_name]
- I would like to name this place (alpha)[waypoint_name]
- Let's call this spot (alpha)[waypoint_name]
- Let's name this location (alpha)[waypoint_name]
- I'd like to call this place (alpha)[waypoint_name]
- save this spot and call it (alpha)[waypoint_name]
- save waypoint
- mark waypoint
- remember this place
- remember this spot
- mark this location
- save this place
- don't forget this spot
- don't forget where this place is
- return here
- (alpha)[waypoint_name]

```

I have two follow up questions:

- Why does the bot not execute `utter_waypoint_save_response` which is setup as “Saving waypoint {waypoint\_name} was {result}”
- Why, instead, does the bot repeat the line “Done with saving None” twice?

---

<div class="post-metadata">

**Author:** ![saurabh-m523](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/saurabh-m523/32/7887_2.png) [@saurabh-m523](https://forum.rasa.com/u/saurabh-m523)\
**Post date:** [October 10, 2020, 2:27pm UTC](https://forum.rasa.com/t/trouble-accessing-slot-data-in-basic-scenario/35700/2 "2020-10-10T14:27:11Z")

</div>

I think the conversation example that you gave, does not follows the story exactly.

Your action seems a bit off. There is no `required_slots` method when you extend from `Action` class. This method is for Form action.

Now, in your stories, `utter_waypoint_save_response` happens right after `action_set_waypoint`, but `action_set_waypoint` is returning a `SlotSet` event which is not present in your story. I suggest you modify your story to something like this:

```auto
## save waypoint confirmation 1
* waypoint_desire_save
  - utter_waypoint_confirm_save
* affirm
  - utter_waypoint_request_name
* waypoint_save{"waypoint_name": "alpha"}
  - slot{"waypoint_name": "alpha"}
  - action_set_waypoint
 - slot{"result": "successful"}
  - utter_waypoint_save_response
* thanks
  - utter_you_are_welcome

```

---

<div class="post-metadata">

**Author:** ![nmill](https://avatars.discourse-cdn.com/v4/letter/n/e79b87/32.png) [@nmill](https://forum.rasa.com/u/nmill)\
**Post date:** [October 10, 2020, 11:20pm UTC](https://forum.rasa.com/t/trouble-accessing-slot-data-in-basic-scenario/35700/3 "2020-10-10T23:20:47Z")

</div>

Thanks Saurabh.

I made the following changes based on your suggestions:

- I edited actions.py to comment out `@staticmethod` and the entire `def required_slots(tracker)` function
- I added `slot{"result": "successful"}` to my story like you showed

My conversation now looks like this:

```
Your input -> I want to save this location
Do you want to save this location?
Your input -> yes
What name do you want to give this location?
Your input -> alpha
Done with saving None
Saving waypoint None was successful
Your input ->

```

That’s a nice improvement! Thanks!

However, I’m still getting `Done with saving None` instead of `Done with saving alpha`. Can you help me understand how to access the slot `waypoint_name` within actions.py?

---

<div class="post-metadata">

**Author:** ![nmill](https://avatars.discourse-cdn.com/v4/letter/n/e79b87/32.png) [@nmill](https://forum.rasa.com/u/nmill)\
**Post date:** [October 11, 2020, 6:19am UTC](https://forum.rasa.com/t/trouble-accessing-slot-data-in-basic-scenario/35700/4 "2020-10-11T06:19:42Z")

</div>

Okay, I got it to work. In addition to the suggestions from Saurabh, here are the changes I made:

- Made sure my `config.yml` was using the `pipeline: supervised_embeddings`. (entities weren’t being extracted with preembeddings.)
- I removed `slot{"waypoint_name": "alpha"}` because entities are automatically stored into slots.
- The format of my intents was incorrect. They should have been `[alpha](waypoint_name)` instead of what I had above.
