Converse API: What else than text?

Hi,

we use the converse API to use our own chat frontend together with botpress.

My question, is it possible to send something else than a message text to the bot by using the converse API?

I have some buttons which have a visible text and a hidden 8 digit long id and I have to send the id to the bot by clicking the button, because we have to use this id as a param for an API call to get the correct result.

Bildschirmfoto 2020-08-27 um 08.49.26

The visible part is the text of the link, but internally we have to use the ID which is an attribute of the button.

Thanks in advance
Frank

@FrankDaze:

Hi You can use quick replies or dropdown for the same:

var dat = { title: dats, value: dats }

  dates.push(dat)
}
let data = {
  choices: dates,
  typing: false,
  listType: 'listDates'
}
var more = { title: 'More', value: 'More1' }
dates.push(more)
const payloads = await bp.cms.renderElement('builtin_single-choice', data, event)
await bp.events.replyToEvent(event, payloads)

}

In ‘dat’ object , use ‘value’ for your backend.

Something like this

image

you can get the value in RAW JSON emulator:

it comes under the JSON part

1 Like

Thanks for your answer. Is that format that you used in dat working with the conversion API as well?

Your answer helps me definitely to understand how to render a builtin_single-choice.
That is something that I tried yesterday on my own without success. :slight_smile:

@FrankDaze : I have used that in actions. Works in web channels

To answer my own initial question:

Unfortunately the Botpress converse API is only accepting type: “text” and nothing else.

I need to send a payload to the bot, so I’m trying now to use the channel-web api with our own middleware.

2 Likes

I agree with you, it’s a bit sad that converse api doesn’t let you send anything else than text. You can use the channel-web api but it’s quite not documented, le me know if you need some help.