Send Hello Name LastName when the user enter in the webpage with the bot embedded


Hello, how I send a message like Hello John Name(name of the user stored in a javascript var) to the bot when the user enter in the webpage with the bot embedded? I use the version 10.5 of botpress.


I tried to read the docs and other posts and I did this in my webpage

var nome = "@ViewBag.UsuarioLogado.NomeCompleto “;
var primeiro_nome=nome.split(” ")[0];

host: ‘localhost:3000’,
botName: ‘Robot’, // Name of your bot
botAvatarUrl: ‘localhost:3000/repositories/chatbot/06.png’, // Default avatar URL of the image (e.g., ‘’ )
botConvoTitle: ‘Chatbot’, // Title of the first conversation with the bot
botConvoDescription: ‘’,
backgroundColor: ‘#ffffff’, // Color of the background
textColorOnBackground: ‘#666666’, // Color of the text on the background
foregroundColor: ‘rgb(148,204,253)’, // Element background color (header, composer, button…)
textColorOnForeground: ‘#ffffff’, // Element text color (header, composer, button…)
showUserName: false, // Whether or not to show the user’s name
showUserAvatar: false, // Whether or not to show the user’s avatar
enableTranscriptDownload: false, // Whether or not to show the transcript download button
matricula: “@ViewBag.UsuarioLogado.Matricula

type: ‘proactive-trigger’,
platform: ‘web’,
text: 'Hi '+primeiro_nome

and in src/index.js

below line 53

bp.hear({ type: /bp_dialog_timeout|text|message|quick_reply/i }, (event, next) => {
bp.dialogEngine.processMessage(event.sessionId ||, event).then()

i wrote

bp.hear({ type: /proactive-trigger/i }, async ({ user, text }, next) => { bp.renderers.sendToUser(user, '#builtin_text', { text: text, typing: true }) next() })

The bots starts normally and I can chat but the welcome message which I created did not work. What I did wrong?


I resolved with this and now works


function BotCarregado(){

		  setTimeout(() => {
			type: 'proactive-trigger',
			platform: 'platform-webchat',
			text: 'Olá '+primeiro_nome
		}, 3000);