Display image from URL stored in state


#1

Display image using URL

I am setting a URL dynamically based on user conversation.

I would like to display that image. Do we have any botpress - builtin for this feature?

If not, how can we accomplish this?

Cheers


Use of HTML in Custom renderer
#2

You could try something like this.


#3

@babbel

Thanks ! this works.

However, i have a follow up question.

How do we make use of HTML markups in custom renderer ?

I have a custom renderer which looks like this :

renderFlower = data => ({
    text:"<img src='https://www.wildabout.co.uk/wp-content/uploads/2018/01/the-english-rose-red-234-470x608-470x608.jpg' width='50px' />",
    typing: '2s'
  })

module.exports = {renderFlower}

This does not work, it simply displays the whole text as string.
I also tried using ` symbol instaed of " , it dosenot help


#4

As an option you could add key makdown: true and have text representing the same in markdown


#5

@alex

Thanks a ton.

I am posting an example of use of markdown for others.

renderFlower = data => ({
    text: data.flowerVariety
      .map((each, index) => {
        return `# ${each.flowerType}`
      })
      .join('\r\n'),
    markdown: true,
    typing: '2s'
  })

module.exports = {renderFlower}

Output

Note :: See the difference between regular text and roses text. Its due to ‘#’ used in front of it.


#6

Hi guys can you please share an example of how to create a custom content and renderer in 11.x ? For instance if I want to render a form which contains a textfield to input name and a radio button to capture gender, what is the best way to do that ?

I tried to update the existing source code of quick replies to render Checkboxes instead of buttons and it works. But that does not sounds correct to me. There should be an Out of the Box way to extend Botpress framework and create and display custom content and render.

Would appreciate feedback. Thanks.


#7

Any suggestions / help / pointers ? How can I create a custom content type and renderer so that I can display a form for example which has a textfield and a radio button for instance using v11.2 of Botpress.