# How to send custom payload using actions and stories

**URL:** <https://forum.rasa.com/t/how-to-send-custom-payload-using-actions-and-stories/1588>\
**Category:** Rasa Open Source\
**Created:** [October 3, 2018, 7:09am UTC](https://forum.rasa.com/t/how-to-send-custom-payload-using-actions-and-stories/1588 "2018-10-03T07:09:00Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![savitha\_1055](https://avatars.discourse-cdn.com/v4/letter/s/71c47a/32.png) [@savitha\_1055](https://forum.rasa.com/u/savitha_1055)\
**Post date:** [October 3, 2018, 7:09am UTC](https://forum.rasa.com/t/how-to-send-custom-payload-using-actions-and-stories/1588/1 "2018-10-03T07:09:00Z")

</div>

![resp](https://europe1.discourse-cdn.com/flex013/uploads/rasa/original/1X/78c703b04704b16ec5b3c6e670f0c9f96c735352.png)I have a custom payload like this in dialogflow and im displaying in form format to user. how to send this response to user using stories and domain.yml and im confusing about how to write this custom payload in actions.py file can anyone help me

---

<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:** [October 4, 2018, 11:27am UTC](https://forum.rasa.com/t/how-to-send-custom-payload-using-actions-and-stories/1588/2 "2018-10-04T11:27:02Z")

</div>

Are these buttons? Or what are they supposed to look like? There’s documentation on how to use buttons [here](https://rasa.com/docs/core/domains/)

---

<div class="post-metadata">

**Author:** ![savitha\_1055](https://avatars.discourse-cdn.com/v4/letter/s/71c47a/32.png) [@savitha\_1055](https://forum.rasa.com/u/savitha_1055)\
**Post date:** [October 4, 2018, 12:29pm UTC](https://forum.rasa.com/t/how-to-send-custom-payload-using-actions-and-stories/1588/3 "2018-10-04T12:29:59Z")

</div>

i want to get the object as response from bot. above data im displaying in form input fields so how to get this data from bot , I tried using custom actions but its not working… how to send custom payload from bot. –\> as im migrating from dialogflow to rasa do i need to write user messages in nlu.md nlu\_md = “”"

## intent:greet

- hey
- hello
- hi
- good morning
- good evening
- hey there

---

<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:** [October 5, 2018, 4:36pm UTC](https://forum.rasa.com/t/how-to-send-custom-payload-using-actions-and-stories/1588/4 "2018-10-05T16:36:06Z")

</div>

i’m still not sure what this custom payload does. Do you want to send a message to the user?

---

<div class="post-metadata">

**Author:** ![savitha\_1055](https://avatars.discourse-cdn.com/v4/letter/s/71c47a/32.png) [@savitha\_1055](https://forum.rasa.com/u/savitha_1055)\
**Post date:** [October 8, 2018, 6:17am UTC](https://forum.rasa.com/t/how-to-send-custom-payload-using-actions-and-stories/1588/5 "2018-10-08T06:17:23Z")

</div>

I mean I want to send response as object apart from text, later i will use that object and display in whatever way i want. will it possible to send bot response as object {}

---

<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:** [October 9, 2018, 4:05pm UTC](https://forum.rasa.com/t/how-to-send-custom-payload-using-actions-and-stories/1588/6 "2018-10-09T16:05:48Z")

</div>

That would probably be what we call a slot, you can store it there and then use it later [Using Slots](https://rasa.com/docs/core/slots/)

---

<div class="post-metadata">

**Author:** ![huberrom](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/huberrom/32/1209_2.png) [@huberrom](https://forum.rasa.com/u/huberrom)\
**Post date:** [November 21, 2018, 3:55pm UTC](https://forum.rasa.com/t/how-to-send-custom-payload-using-actions-and-stories/1588/7 "2018-11-21T15:55:02Z")

</div>

I have the same issue and I’m not sure “slot” is responding to it. My use case is that I want to send a field name “action” with a value (action\_1, action\_2 etc…) so that the chat will react to this action (by starting a download for example). Can you confirm me that for the moment, the response can only contains text and data (which can only contains attachments/buttons/elements ?

Edit : I think I found a solution, by creating a new class that override output methods, I’ll try and upload my response if it works for future users.

---

<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:** [December 2, 2018, 8:57pm UTC](https://forum.rasa.com/t/how-to-send-custom-payload-using-actions-and-stories/1588/8 "2018-12-02T20:57:56Z")

</div>

Could you provide an example of what you mean @huberrom? I’m not sure I understand

---

<div class="post-metadata">

**Author:** ![jwickers](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/jwickers/32/1178_2.png) [@jwickers](https://forum.rasa.com/u/jwickers)\
**Post date:** [December 3, 2018, 2:10am UTC](https://forum.rasa.com/t/how-to-send-custom-payload-using-actions-and-stories/1588/9 "2018-12-03T02:10:14Z")

</div>

It seems like he wants to enrich the bot response, this could be useful in some cases: for example if the user interacts via a website chat widget and ask where to find X ( a feature or button or link) on the page, and we then want the widget to highlight some element in the page.

Then the bot response could have both the text and a custom JSON payload the widget would use (eg: `{highlightTarget: 'someElement'}`

This could be useful for custom clients like website embedded JS clients, but not really other channels I guess.

---

<div class="post-metadata">

**Author:** ![huberrom](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/huberrom/32/1209_2.png) [@huberrom](https://forum.rasa.com/u/huberrom)\
**Post date:** [December 3, 2018, 8:38am UTC](https://forum.rasa.com/t/how-to-send-custom-payload-using-actions-and-stories/1588/10 "2018-12-03T08:38:04Z")

</div>

Yup that’s exactly what I want to do !

I found the solution by overriding the output channel (and the send\_custom\_message function). But it should be easier to do so.

---

<div class="post-metadata">

**Author:** ![huberrom](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/huberrom/32/1209_2.png) [@huberrom](https://forum.rasa.com/u/huberrom)\
**Post date:** [December 3, 2018, 4:54pm UTC](https://forum.rasa.com/t/how-to-send-custom-payload-using-actions-and-stories/1588/11 "2018-12-03T16:54:02Z")

</div>

So, as I said, I have overloaded the Output and Input channel, but now I want to open a route for the tracker/event (to modify slots without using the core/nlu). My problem is that I don’t understand how to create an agent. To be precise I exactly want to do the same as the route /conversations/sender\_id/tracker/events but change the route.

The problem with the code of this method is that it’s using an agent and I don’t know how to create one.

---

<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:** [December 19, 2018, 2:17pm UTC](https://forum.rasa.com/t/how-to-send-custom-payload-using-actions-and-stories/1588/12 "2018-12-19T14:17:02Z")

</div>

@huberrom would you be willing to create a PR for something like this?

---

<div class="post-metadata">

**Author:** ![huberrom](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/huberrom/32/1209_2.png) [@huberrom](https://forum.rasa.com/u/huberrom)\
**Post date:** [December 19, 2018, 2:55pm UTC](https://forum.rasa.com/t/how-to-send-custom-payload-using-actions-and-stories/1588/13 "2018-12-19T14:55:04Z")

</div>

I don’t know if my custom channel is generic enough to create a PR to be honest. The output channel is just overriding the send\_custom\_channel to send a payload that looks like that :

```
{
    "text" : "Text to send",
    "custom" : {
             # custom payload with any fields needed
    }
}

```

I have the control of the chat that send the request, so I can parse easily all the elements that are in the custom field.

For the input channel, I have a custom verify\_auth\_token method, health, respond and tracker/events routes.

I don’t think it’s worth a PR, is it ?

---

<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:** [January 8, 2019, 10:05am UTC](https://forum.rasa.com/t/how-to-send-custom-payload-using-actions-and-stories/1588/14 "2019-01-08T10:05:09Z")

</div>

You mean this method right? [rasa\_core/channel.py at master · RasaHQ/rasa\_core · GitHub](https://github.com/RasaHQ/rasa_core/blob/master/rasa_core/channels/channel.py#L196)

---

<div class="post-metadata">

**Author:** ![huberrom](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/huberrom/32/1209_2.png) [@huberrom](https://forum.rasa.com/u/huberrom)\
**Post date:** [January 8, 2019, 10:36am UTC](https://forum.rasa.com/t/how-to-send-custom-payload-using-actions-and-stories/1588/15 "2019-01-08T10:36:53Z")

</div>

Yes, this is the method I overloaded, because it only accepts title/subtitle/buttons and I needed more fields in my JSON.

---

<div class="post-metadata">

**Author:** ![mark922](https://avatars.discourse-cdn.com/v4/letter/m/ecb155/32.png) [@mark922](https://forum.rasa.com/u/mark922)\
**Post date:** [March 19, 2019, 10:47am UTC](https://forum.rasa.com/t/how-to-send-custom-payload-using-actions-and-stories/1588/16 "2019-03-19T10:47:18Z")

</div>

@akelad I did the same. It would be helpful if you guys can add “custom payload” support by default in UserMessage. I was found few examples in http api docs on how to use Buttons, elements, attachments etc. I think it would be a great help for beginners if you can add few examples of each use case.

---

<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:** [March 29, 2019, 12:56pm UTC](https://forum.rasa.com/t/how-to-send-custom-payload-using-actions-and-stories/1588/17 "2019-03-29T12:56:59Z")

</div>

@mark922 we’re working on refactoring I/O channels a bit at the moment, so we should have something like that in the future hopefully

---

<div class="post-metadata">

**Author:** ![carla.lmeida](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/carla.lmeida/32/760_2.png) [@carla.lmeida](https://forum.rasa.com/u/carla.lmeida)\
**Post date:** [March 2, 2020, 4:29pm UTC](https://forum.rasa.com/t/how-to-send-custom-payload-using-actions-and-stories/1588/18 "2020-03-02T16:29:08Z")

</div>

Hey @akelad! Do you know if there are any updates on this topic? I’ve run into the same problem and was searching for a solution

---

<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:** [March 3, 2020, 10:12am UTC](https://forum.rasa.com/t/how-to-send-custom-payload-using-actions-and-stories/1588/19 "2020-03-03T10:12:23Z")

</div>

Sending custom payloads is now fully supported: [Domains](https://rasa.com/docs/rasa/core/domains/#custom-output-payloads)

---

<div class="post-metadata">

**Author:** ![Minute\_Man](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/minute_man/32/12403_2.png) [@Minute\_Man](https://forum.rasa.com/u/Minute_Man)\
**Post date:** [December 14, 2020, 5:54pm UTC](https://forum.rasa.com/t/how-to-send-custom-payload-using-actions-and-stories/1588/20 "2020-12-14T17:54:31Z")

</div>

Hey @akelad, Am having difficulty with implementing a custom payload. I would like to display images with buttons and a small text description below the image. Please advise.
