Closed shubham-vEngageAi closed 2 years ago
Hi FredrikOseberg, I want to change the bot initial message dynamically. But I am unable to do that. please can you tell me the way to do that? This requirement is very important for us .
Thanks and regards Shubham Kumar
You could wrap the config in a function, and provide the initial message as a parameter to that function:
getConfig = (message) => ({ initialMessages: [createChatBotMessage(message)] })
I want to pass the message to ChatBot from APP.js
but i am getting an error
You can add as many dynamic messages as possible - even via rest api Just make config dynamic ;-)
const botinitconfig = { botid: 111, botheader: 'Pompy Bot', startertext: 'Welcome', botMessageBox: '#376B7E', chatButton:'#5ccc9d', initialMessages: init() }
const init = () => { var initMessages = ['Welcome', 'Pompy', 'Dynamic Init Message Works']; return ( initMessages.map(function (message, index) { return createChatBotMessage(message) })) }
<Route path="/" element={< ChatBotPage botinit={botinitconfig} / >}/>
Hi FredrikOseberg, I want to change the bot initial message dynamically. But I am unable to do that. please can you tell me the way to do that? This requirement is very important for us .
Thanks and regards Shubham Kumar