Trigger Chat from Link or Button on Webpage


#1

Hi, I am wondering if it is possible to initiate a chat when the user clicks on a link or button on the webpage that they are viewing?


#2

Yes, it is possible to open chat using a link or button.

<a href="#" onclick="CollectChatLauncher.open()">Open Chat</a>

This is a sample link that can be used to trigger chatbot.

You can find more details here:

https://help.collect.chat/article/show/69233-how-to-trigger-chatbot-from-a-link-or-a-button


#3

@shyjal is it possible to extend the method you have demonstrated, to trigger multiple different Collect Chat bots from the same page?


#4

Yes, The same method can open a different bot than you initially installed on a page.

<a href="#" onclick="CollectChatLauncher.open('5ad9cbf6b17dad848274698a')">Open Chat</a>

This will open a new bot with id ‘5ad9cbf6b17dad848274698a’. You can open any bot by knowing its bot ID.

Alternatively, there is an extra javascript function which loads another bot but does not open it.

CollectChatLauncher.load('5ad9cbf6b17dad848274698a')

You can find your bot’s ID in the bottom of ‘Builder > Publish’ page.

I hope these functions fulfil your use case. If you have any question, please reply here or mail us to [email protected]

Cheers!
Shyjal


#5

Hi Shyjal, thank you for this informaion. I was wondering if there is a way that the bot is on the page but only appears as a pop up when someone is exiting my website? Is that possible?

Thank you!


#6

Hi there,

This was a point of discussion once. Please see here - https://community.collect.chat/t/feature-request-thread/18/54?u=aslam

Regards,
Aslam