# Is it possible to pass more data in response?

**URL:** <https://forum.rasa.com/t/is-it-possible-to-pass-more-data-in-response/15223>\
**Category:** Rasa Open Source\
**Created:** [September 4, 2019, 10:59am UTC](https://forum.rasa.com/t/is-it-possible-to-pass-more-data-in-response/15223 "2019-09-04T10:59:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kaladin](https://avatars.discourse-cdn.com/v4/letter/k/f475e1/32.png) [@kaladin](https://forum.rasa.com/u/kaladin)\
**Post date:** [September 4, 2019, 10:59am UTC](https://forum.rasa.com/t/is-it-possible-to-pass-more-data-in-response/15223/1 "2019-09-04T10:59:12Z")

</div>

Hi, it’s possible to add more data in request: [How to pass metadata in POST request and then extract it?](http://forum.rasa.com/t/how-to-pass-metadata-in-post-request-and-then-extract-it/15092)

But is it possibie to do the same thing with response?

Example:

After sending POST request with body:

```
{
   "sender": "323",
   "message": "hey"
}

```

I want to pass slot values into response (but not as a text)

```
[
    {
        "recipient_id": "323",
        "text": "Hey"
    },
    {
        "recipient_id": "323",
        "metadata": 
        {
            "email":"email@from.slot"
        }
    }
]

```

Is something like this achievable?

---

<div class="post-metadata">

**Author:** ![erohmensing](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/erohmensing/32/1789_2.png) [@erohmensing](https://forum.rasa.com/u/erohmensing)\
**Post date:** [September 4, 2019, 12:38pm UTC](https://forum.rasa.com/t/is-it-possible-to-pass-more-data-in-response/15223/2 "2019-09-04T12:38:48Z")

</div>

looks like you want to check out [Custom Output Payloads](https://rasa.com/docs/rasa/core/domains/#custom-output-payloads)

---

<div class="post-metadata">

**Author:** ![kaladin](https://avatars.discourse-cdn.com/v4/letter/k/f475e1/32.png) [@kaladin](https://forum.rasa.com/u/kaladin)\
**Post date:** [September 4, 2019, 1:35pm UTC](https://forum.rasa.com/t/is-it-possible-to-pass-more-data-in-response/15223/3 "2019-09-04T13:35:39Z")

</div>

Thanks for an answer, but I’m still having trouble with passing slot to response.

if I create template like this:

```
  utter_test_metadata:
    - custom:
        - first_name: "{first_name}"

```

The respone looks like this (its not extracting slot):

```
{
        "recipient_id": "323",
        "custom": [
            {
                "first_name": "{first_name}"
            }
        ]
    },

```

And if I create template like this:

```
  utter_test_metadata:
    - custom:
        - first_name: {first_name}

```

The response:

```
{
        "recipient_id": "323",
        "custom": [
            {
                "first_name": {
                    "first_name": null
                }
            }
        ]
    },

```

What is the proper way of passing slot here?

---

<div class="post-metadata">

**Author:** ![kaladin](https://avatars.discourse-cdn.com/v4/letter/k/f475e1/32.png) [@kaladin](https://forum.rasa.com/u/kaladin)\
**Post date:** [September 5, 2019, 11:24am UTC](https://forum.rasa.com/t/is-it-possible-to-pass-more-data-in-response/15223/5 "2019-09-05T11:24:00Z")

</div>

Solution :

In custom action create template for custom output, then fill this template with slot values

```
def run(self, dispatcher, tracker, domain):
    first_name = tracker.get_slot("first_name")
    last_name = tracker.get_slot("last_name")
    template = {
        "custom": {
            "first_name": "{first_name}",
            "last_name": "{last_name}"
        }
    }
    t = TemplatedNaturalLanguageGenerator(templates=dict())
    result = t._fill_template(template=template, filled_slots={"first_name": first_name, "last_name": last_name})

    dispatcher.utter_custom_json(result)

```

Now, the slot values can be found in response:

```
{
    "recipient_id": "3221223",
    "custom": {
        "custom": {
            "first_name": "aaaa",
            "last_name": "bbbb"
        }
    }
},

```

More details here:

[https://github.com/RasaHQ/rasa/pull/4079/files](https://github.com/RasaHQ/rasa/pull/4079/files)
