How to Post an Auto Message When Client Initiate Chat for The First Time?

  • Updated

There is a time when we want our chat system send a message, as if it were from a user who is about to use our chat for the first time. This feature is common in Facebook Messenger with its "Get Started" message or in Telegram with its "/start". So, how do we do that in Qiscus widget?

You could flag user whether it is his/her first time to use the chat and make use of "sendComment" method in "chatRoomCreatedCallback" to do send a message. Shown in a snippet code below for web SDK, 

AppId: [your app id],
options: {
avatar: !0,
loginSuccessCallback: function() {
// Do something after successfully login
// Chat with available user, need to be register first
chatRoomCreatedCallback: function (room) {
// if this is for the first time user is having chat, than send "hi" to SDK
// as first trigger for bot
if (first_chat) {
var activeRoomId =;
var today = new Date();
var uniqueId = today.getTime();
var messageText = 'Hi' // you can use any text to trigger bot to start a conversation

// send comment to SDK

// update first_chat value
i['first_chat'] = false;
localStorage.setItem("data", JSON.stringify(i))

Was this article helpful?



Please sign in to leave a comment.