I want to show the First name from the Context Session in the Welcome Message while using bot. But I am not able to show it. I have used <%= context.session.UserContext.firstName %> and {{context.session.UserContext.firstName}}.
Hi Himanshu, using {{context.session.UserContext.firstName}} in the message prompt for welcoming user by name should work. I tested and it worked. See below for reference.
Thanks for your reply. Actually I want to show the user name on Welcome Message which we configured in Settings session. Like in your snapshot the name should appear after “Hi!” itself.
Himanshu, you can customise the welcome message at Bot settings as shown below. This way, Bot welcomes or greets the user based on the name given in the session.
I tried the same thing in this Welcome Message, but it doesn’t get render in chat window. It display as it is like {{context.session.UserContext.firstName}} not the actual name. I think you should also not be able to see user name in welcome message. Can you check and paste the screenshot of chat window with User name?
@chenchukishore.thathWelcome event only gets triggered the first time user sends the message. The consecutive conversations wouldn’t have the event triggered to the user.
Also, if in case you requirement is to show message when user is connected, then you could use the On connect event. Else if, the requirement is to send welcome message on first message from user, welcome event can be configured.
In case, both welcome event and on connect event are configured, then for websdk as a channel, the on connect event would take precedence.
@chenchukishore.thath You could configure the chat history to load or not load at webSDK channel. In the index.html file at the variable chatConfig, you should see the parameter “loadHistory”. On setting it to “false” , the chatHistory wouldn’t be loaded to the user.
@chenchukishore.thath Glad we could help you with the “onconnect” event. You couldn’t disable the chathistory when you are testing the bot on the bot builder itself. If you have configured the webSDK channel which is available at https://github.com/Koredotcom/web-kore-sdk , then you should find it inside the UI folders as shown below:
Hi @rajinisiva93,
Both the events on connect and welcome have the options to invoke a dialog, run a script or send a message.
Data available in the session context can be utilized in all three ways. The only way you could add some data to the context from webSDK is by adding the needed information in the customData at botinfo of index.html.
The added information should be available under BotUserSession. Detailed steps on how to add the customData and where the data is accessible are mentioned at the below post.