How to send images using hooks in Botpress

Can anyone help me to give an example of sending images from hooks?

Hello,

In this example, I use an “after incoming middleware” hook to send a message in case the user visits the chat window :

async function hook() {
    if (event.type === 'visit') {
      bp.events.replyToEvent(event, await bp.cms.renderElement('!builtin_image-aC3C1x', {}, event))
    }
}

return hook()

The element string should be the id of your contentElement

1 Like

thank you so much. It works