How to send payload to the client?

In the domain.yml for a single utterance template an image can be specified as additional payload. I am using the /respond endpoint of the rasa core server. This endpoint provides the image payload (if defined) as an additional message that contains an attachment, which is the image link.

Is it possible to send other data as payload/attachment with an utterance template, e.g. send the content of a slot or let the payload be defined by a custom action?

I am thinking of something like this:

domain.yml:

templates:
    utter_any:
        - text: "any text"
        - data: {slotname}

Such that the content of the slot ‘slotname’ is sent as payload similiar to images

Please take a look at the docs here, under “Images and Buttons”: http://rasa.com/docs/core/domains/

Yes, I have read that part of the documentation and implemented the image feature into untterances. Additionally, I investigated in which form the image is transmitted to the client using the /respond endpoint.

The following structure is received by the client:

[
  {
    "recipient_id": "default",
    "text": "some text..."
  },
  {
    "recipient_id": "default",
    "text": "Image: https://dictionary.cambridge.org/de/images/full/cat_noun_001_02368.jpg"
  }
]

However, I want the second response to use a different tag than ‘Image’. I would like to be able to set a different tag like ‘Data’ or ‘Url’, such that my client can distinguish regular text messages that should be displayed in chat log from data that need a different formatting.

The workaround I found is setting the tag by myself using an regular utterance with text:

utter_data: - text: "Data: {dataslot}"

However, this is not stored as an attachement in the event history in the tracker as it is for Image tags (since it is only a text utterance). Using my workaround stores the data as text message:

{'data': None, 'event': 'bot', 'text': 'Data: .. some data', 'timestamp': 1535967934.8861153}

In comparison Image tag is recognized as data and thus it is marked as attachement in the tracker event history:

{'data': {'attachment': 'https://dictionary....02368.jpg'}, 'event': 'bot', 'text': None, 'timestamp': 1535966845.3623219}

To be able to distinguish data slots from regular text messages i want to set different tags than Image when defining utterances, e.g. in the domain.yml

How can this be achieved?

Can I ask what exactly you want to achieve? Do you want to set a slot somehow?

I want to send data (e.g. the content of a slot set by a custom action) to the client/UI, which is tagged distiguishable from a regular text responses (like the Image response).

You should just be able to grab this from the tracker though if you’re building a custom UI

You should be able to use a SocketIOInput channel, and add that to the agent. Then your client will just need to listen to a websocket for the bot uttered event.

Hi @akelad

Please update the link you provide for comments .

Since I trust you and hope that you can do that . I have started rasa and hence lots of issues I am facing which led me to rasa hq . But the link you have provided at many place are outdated.

@Grasshooper the links should all redirect properly now