Getting Started for Developers
Welcome to the Ulka Chat Developer community! This guide will help you integrate Ulka Chat into your website or application using our JavaScript SDK.
Prerequisites
Before you can integrate Ulka Chat, you need:
- An Ulka Chat Account: Sign up at ulka.chat (opens in a new tab).
- An Organization: Create an organization in your Ulka Chat dashboard.
- A Plugin Key: Obtain your unique plugin key from your organization settings.
Step 1: Create an Organization
- Log in to your Ulka Chat account.
- If you haven't created an organization yet, you'll be prompted to create one.
- Enter your organization name and complete the setup process.
- Your organization dashboard will be displayed.
Step 2: Get Your Plugin Key
The plugin key is essential for authenticating your website with Ulka Chat.
- In your organization dashboard, go to Settings > Organization Settings.
- Navigate to the Plugin Key section.
- Copy your unique plugin key. This key is specific to your organization.
- Keep your plugin key secure and do not expose it in public repositories.
Step 3: Install the JavaScript SDK
The Ulka Chat SDK is distributed via CDN and requires Socket.io. Add the following code to your HTML page before the closing </body> tag:
<!-- Include Socket.io from CDN -->
<script src="https://cdn.socket.io/4.7.5/socket.io.min.js"></script>
<!-- UlkaChat CDN -->
<script src="https://ulkachat.saratech.com.bd/sdk/1.0.0/chat.js"></script>
<!-- Initialize Chat -->
<script>
// Initialize the chat SDK
Chat.init({
apiBaseUrl: 'https://api.ulka.chat', // Replace with your API URL
pluginKey: 'YOUR_PLUGIN_KEY' // Replace with your plugin key from Step 2
});
// Optional: Destroy chat when needed
// Chat.destroy();
</script>Configuration Options
The Chat.init() method accepts the following configuration:
- apiBaseUrl (required): The base URL of your Ulka Chat API server (e.g.,
https://api.ulka.chatorhttp://localhost:4000for local development). - pluginKey (required): Your organization's unique plugin key obtained from the dashboard.
Step 4: Verify Installation
- Save your HTML file and open it in a web browser.
- The Ulka Chat widget should appear on your page (typically in the bottom-right corner).
- Click the widget to open the chat interface.
- Send a test message to verify the connection is working.
SDK Methods
Initialize Chat
Chat.init({
apiBaseUrl: 'https://api.ulka.chat',
pluginKey: 'YOUR_PLUGIN_KEY'
});Destroy Chat Instance
Chat.destroy();This removes the chat widget from the page and cleans up resources.
Troubleshooting
Chat Widget Not Appearing
- Verify that Socket.io is loaded before the Ulka Chat SDK.
- Check that your plugin key is correct and matches your organization.
- Ensure the
apiBaseUrlis accessible from your domain. - Check the browser console for any JavaScript errors.
Connection Issues
- Verify your API URL is correct and the server is running.
- Check that your plugin key is valid and hasn't been revoked.
- Ensure your network allows WebSocket connections.
Resources
Need technical assistance? Email us at dev-support@ulka.chat.