How to Send Additional User Information Using the Akece SDK
The Akece SDK allows you to send additional information about users accessing your website directly to the platform.
This data helps your team deliver more personalized support.
Initializing the SDK
After installing the Akece widget on your website, the window.$akece object becomes available. To ensure it’s fully
loaded, listen for the akece:ready event:
window.addEventListener("akece:ready", function () {
// Use window.$akece here
});
You can also listen for incoming messages with:
window.addEventListener("akece:on-message", function(e) {
console.log('akece:on-message', e.detail);
});
Widget Settings
You can customize the widget’s behavior using window.akeceSettings:
window.akeceSettings = {
hideMessageBubble: false,
showUnreadMessagesDialog: false,
position: "right",
locale: "pt_BR",
useBrowserLanguage: false,
type: "standard",
darkMode: "auto",
showPopoutButton: true,
launcherTitle: "Talk to us"
};
Widget Design Types
- standard: Traditional chat icon
- expanded_bubble: Expanded bubble with custom title
Auto Language Detection
Enable automatic detection based on browser language:
useBrowserLanguage: true
Note: This will override the locale setting.
Open or Hide the Widget Programmatically
window.$akece.toggleBubbleVisibility("show");
window.$akece.toggleBubbleVisibility("hide");
window.$akece.toggle(); // Toggle open/close
window.$akece.toggle("open"); // Open
window.$akece.toggle("close"); // Close
Open in a Pop-up Window
window.$akece.popoutChatWindow();
Identifying a User
Use setUser to associate user data with the widget:
window.$akece.setUser("UNIQUE_USER_ID", {
email: "[email protected]",
name: "User Name",
avatar_url: "https://image-url.com",
phone_number: "+551199999999"
});
HMAC Validation
To enhance security and prevent impersonation, HMAC validation is recommended:
window.$akece.setUser("UNIQUE_USER_ID", {
name: "Name",
email: "[email protected]",
identifier_hash: "GENERATED_HASH",
phone_number: "+55...",
avatar_url: "https://...",
description: "User profile",
country_code: "BR",
city: "São Paulo",
company_name: "Company",
social_profiles: {
linkedin: "username"
}
});
📌 See our technical documentation to learn how to generate the HMAC hash.
Custom Attributes
Send additional user data using setCustomAttributes:
window.$akece.setCustomAttributes({
plan: "premium",
signupDate: "2024-01-01"
});
To remove a specific custom attribute:
window.$akece.deleteCustomAttribute("plan");
Set Labels Before the Conversation Starts
If the visitor hasn’t started a conversation yet, you can preset labels:
window.$akece.setLabel("support-request");
window.$akece.removeLabel("support-request");
Manually Set Language
window.$akece.setLocale("pt_BR");
Reset Session (Logout)
window.$akece.reset();
Monitor Widget Errors
window.addEventListener("akece:error", function () {
// Error handling logic
});
If you need help integrating the SDK or sending custom data to the widget, feel free to reach out:
📩 [email protected]
📱 @akece.ai