# How to set slots in the initial request

**URL:** <https://forum.rasa.com/t/how-to-set-slots-in-the-initial-request/49987>\
**Category:** Rasa Open Source\
**Created:** [December 14, 2021, 7:21am UTC](https://forum.rasa.com/t/how-to-set-slots-in-the-initial-request/49987 "2021-12-14T07:21:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![anuravi](https://avatars.discourse-cdn.com/v4/letter/a/c67d28/32.png) [@anuravi](https://forum.rasa.com/u/anuravi)\
**Post date:** [December 14, 2021, 7:21am UTC](https://forum.rasa.com/t/how-to-set-slots-in-the-initial-request/49987/1 "2021-12-14T07:21:44Z")

</div>

Hi, I am trying to create a simple bot. When the user launches the bot, I want to save some slot variables that are specific to the user like locale, device type, user type etc. These values will be used later in custom action webhook calls. I am using the endpoint: [http://localhost:5005/webhooks/rest/webhook](http://localhost:5005/webhooks/rest/webhook). I tried the initial request like this and tried to read the slot values in custom action. But the values are not present.

{ “sender”:“user1”, “message”:"/greet{‘name’:‘user1’, ‘language’:‘de\_DE’}" }

Do I have to make changes in stories.yml and domain.yml? Is it possible to set these values without any entity extraction/custom actions? The “greet” intent does not have any entities defined.

Thank you.

---

<div class="post-metadata">

**Author:** ![ILG2021](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/ilg2021/32/18166_2.png) [@ILG2021](https://forum.rasa.com/u/ILG2021)\
**Post date:** [December 14, 2021, 7:53am UTC](https://forum.rasa.com/t/how-to-set-slots-in-the-initial-request/49987/2 "2021-12-14T07:53:45Z")

</div>

```auto
class ActionSetData(Action):
    def name(self) -> Text:
        return "action_set_data"

    def run(self, dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
        name= next(tracker.get_latest_entity_values("name"), None)
        language= next(tracker.get_latest_entity_values("language"), None)
        return [SlotSet("name", name), SlotSet("language", language)]

```

You need a custom action.

---

<div class="post-metadata">

**Author:** ![anuravi](https://avatars.discourse-cdn.com/v4/letter/a/c67d28/32.png) [@anuravi](https://forum.rasa.com/u/anuravi)\
**Post date:** [December 14, 2021, 5:24pm UTC](https://forum.rasa.com/t/how-to-set-slots-in-the-initial-request/49987/3 "2021-12-14T17:24:17Z")

</div>

Thank you @ILG2021 for you reply. I tried the customer set data action but the values are coming as None. The values that I want to store in slots are not part of any entities in the greet message. These are the values specific to the user’s profile. Is there any way to save these values in slots during the first api call to rasa server.

---

<div class="post-metadata">

**Author:** ![ILG2021](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/ilg2021/32/18166_2.png) [@ILG2021](https://forum.rasa.com/u/ILG2021)\
**Post date:** [December 15, 2021, 12:23am UTC](https://forum.rasa.com/t/how-to-set-slots-in-the-initial-request/49987/4 "2021-12-15T00:23:45Z")

</div>

ok. Do you send the message by /set\_data{‘name’:‘user1’, ‘language’:‘de\_DE’} and add the rule:

```auto
rule: set data
steps:
  - intent: set_data
  - action: action_set_data

```

when you send message by /set\_data{‘name’:‘user1’, ‘language’:‘de\_DE’}, set\_data will be recogize as a intent, and the json after set\_data will be extracted as entities. I have use these in my project and works ok. You should use /set\_data before you use the slot.
