How to send custom payload using actions and stories

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

Are these buttons? Or what are they supposed to look like? There’s documentation on how to use buttons here

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

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

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 {}

That would probably be what we call a slot, you can store it there and then use it later Using Slots

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.

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

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.

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.

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.

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

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 ?

You mean this method right? rasa_core/channel.py at master · RasaHQ/rasa_core · GitHub

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

1 Like

@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.

1 Like

@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

1 Like

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

Sending custom payloads is now fully supported: Domains

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.