What it is
Besides the balloon in the screen corner, the chat can be opened by any link or button on your own page: a “Talk to a specialist” in the middle of the text, a button on a product page, a call to action on your pricing screen. The click opens the chat and, if you want, already sends a first message on the visitor’s behalf, so the conversation starts from there.
The feature works on all three web chat types — public, intranet authenticated and password-protected — with small behavior differences in each one.
1. When to use
- To highlight support outside the screen corner, like an action button on the page;
- To start the conversation with context, for example “I came from a product page”;
- To open the chat at the right moment, guided by the website’s own content.
2. Public chat: opening and sending a message
With the chat code installed (see Public Chat), the SEND_MESSAGE event does both: it opens the chat, even when it is closed, and sends the text you pass:
<a href="#support" id="cta-chat">
Talk to a specialist
</a>
<script>
document
.getElementById('cta-chat')
.addEventListener('click', function (event) {
event.preventDefault();
window.CarameloChatbotClient.triggerPageEvent('SEND_MESSAGE', {
message: 'Hi! I came from the website and would like to talk to a specialist.'
});
});
</script>
The message arrives as if the visitor had typed it, so the agent answers in the same conversation. Instead of a link, you can use a <button type="button"> — there is no navigation to prevent, so event.preventDefault() becomes optional.
3. Message stored on the agent
Instead of writing the text on the website, create a page event in the agent’s Events tab (automatic message type, for example TALK_TO_SPECIALIST) with the message you want. The website fires only the name:
window.CarameloChatbotClient.triggerPageEvent('TALK_TO_SPECIALIST');
The text sent is the one stored on the agent — to change the button’s message, you don’t touch the website. After creating or editing the event, save and publish a version for it to take effect. The open-the-chat behavior is the same as SEND_MESSAGE.
4. Authenticated chat (intranet)
In the authenticated chat, the same event works on the chat instance your website creates. Combine the click’s start() (see the intranet guide) with the event:
document.getElementById('abrir-chat').addEventListener('click', function () {
chat.start();
chat.triggerPageEvent('SEND_MESSAGE', {
message: 'Hi! I need help with my account.'
});
});
You don’t need to wait for the chat to load before firing the event: while the chat isn’t ready, it stays in a queue and is sent as soon as the connection is up.
5. Login and password chat
In the password-protected chat, the click opens the chat, which shows the login screen. The automatic message is not sent while the visitor hasn’t logged in — and the click isn’t kept for later.
For this chat type, prefer letting the agent greet visitors with its own initial message, or place the buttons on pages the visitor only reaches after logging in.
6. How the click behaves
Applies to the chat types where the automatic send is allowed (public and intranet):
| Situation | What happens |
|---|---|
| Chat was closed | It opens automatically before sending. |
| Visitor already chatted before | In the same browser, the previous conversation continues — the click picks up from there. |
| Several clicks | Every accepted click sends a new message; while an automatic send is in progress, the following ones are ignored. |
| Empty message or longer than 3000 characters | The click is ignored and the chat doesn’t open. |
7. Frequently asked questions
Does it work on WordPress, Wix, React and other platforms?
Yes, on any website where the chat code is installed. Put the button's script together with the page content or in the same custom code block.
I put the button on a password-protected chat and the message wasn't sent. Why?
In the login and password chat, the automatic send only applies to already-authenticated visitors. While the password is required, the click opens the chat on the login screen, but the message isn't sent or retried later.
Does the message appear as if the visitor typed it?
Yes. It enters the conversation as a visitor message, and the agent answers normally.