Proactive action issue


hi all,
i added code in my website, it is working fine it will automatically pop up the bot
window.botpressWebChat.sendEvent({ type: ‘show’ })
type: ‘proactive-trigger’,
channel: ‘web’,
payload: {
text: ‘smth’

but how to use payload “text:smith” and send that text to bot when chat bot triggers.
before that where exactly(in which file) should i add below code to work fine

if (event.type === 'proactive-trigger') {
  const payloads = await bp.cms.renderElement('builtin_text', { text: 'Hey there!', typing: true },, payloads)
1 Like

I’m also struggling to make ‘proactive-trigger’ triggers work on my bot, so what I’m about to advice you is not 100% true, but this is what I could find:

The ‘proactive-trigger’ strip of code should be added inside a new file, in the data/global/hooks folder.

Files inside the hooks folder:

  • are read in order of their name, that’s why you see 00_dialog… and 01_expire…;
  • that start with a “.” are files that are never read by the bot;

My issue with this is that my bot triggers a response, but it never delivers my message, instead the bot responds with the next conversation from my flow.


yeah same issue im facing, lets wait for others to reply
if you got any solution reply here

1 Like

As per last developer documentation

you must pass the event object to renderElement method
Also to get the payload value you have to get it by



“use strict”;

const setProactive = async () => {

if (event.type === ‘proactive-trigger’) {
bp.logger.warn( `Just received a postback event: ${} ${event.payload.payload.payload.text}` );
// Sends a basic text message
const payloads = await bp.cms.renderElement(‘builtin_text’, {
text: event.payload.payload.payload.text,
typing: true
}, event);
await, payloads);


return setProactive();