Chat Widget Setup
Introduction
The MarketFit Chat API provides a complete interface for integrating real-time chat functionalities into your website. This system allows you to create contextual chat experiences, manage conversations, and automate user interactions.
Installation and Configuration
Initialization
To enable the chat, you need to initialize the system with the chat configuration object.
// Initialize the full system with chat enabled
window.MarketFit.init({
siteId: 'your-site-id',
apiEndpoint: 'https://api.your-domain.com',
chat: {
enabled: true,
agentName: 'Support',
welcomeMessage: 'Hello! How can I help you?',
title: 'Chat with us',
position: 'bottom-right',
theme: {
primaryColor: '#007bff',
secondaryColor: '#e9ecef',
textColor: '#212529'
},
accentColor: '#2f66c9',
allowAnonymousMessages: false
}
});init()
Initializes the complete MarketFit system with all necessary configurations.
Syntax
window.MarketFit.init(config)Parameters
configobject (required): Complete system configuration
Configuration Parameters
Main Configuration
siteIdstring (required): Unique identifier for your siteapiEndpointstring (required): API endpoint URLchatHiddenboolean (optional): Start chat hidden. Default: falsechatobject (optional): Specific chat configuration
Chat Configuration
enabledboolean: Enable/disable chatagentNamestring: Default agent namewelcomeMessagestring: Initial welcome messagetitlestring: Chat widget titlepositionstring: Widget position (‘bottom-right’ | ‘bottom-left’)themeobject: Color and appearance configurationallowAnonymousMessagesboolean: Allow anonymous messages
Examples
Basic initialization:
window.MarketFit.init({
siteId: 'your-site-id',
apiEndpoint: 'https://api.your-domain.com',
chat: {
enabled: true,
agentName: 'Support',
welcomeMessage: 'Hello! How can I help you?',
title: 'Chat with us'
}
});Initialization with hidden chat:
window.MarketFit.init({
siteId: 'your-site-id',
apiEndpoint: 'https://api.your-domain.com',
chatHidden: true, // Chat will start hidden
chat: {
enabled: true,
agentName: 'Support',
welcomeMessage: 'Hello! How can I help you?',
title: 'Chat with us'
}
});Last updated on