Ulka Chat is now in Public Beta. Check out our latest features. Visit ulka.chat →
Getting Started
For Developers

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:

  1. An Ulka Chat Account: Sign up at ulka.chat (opens in a new tab).
  2. An Organization: Create an organization in your Ulka Chat dashboard.
  3. A Plugin Key: Obtain your unique plugin key from your organization settings.

Step 1: Create an Organization

  1. Log in to your Ulka Chat account.
  2. If you haven't created an organization yet, you'll be prompted to create one.
  3. Enter your organization name and complete the setup process.
  4. Your organization dashboard will be displayed.

Step 2: Get Your Plugin Key

The plugin key is essential for authenticating your website with Ulka Chat.

  1. In your organization dashboard, go to Settings > Organization Settings.
  2. Navigate to the Plugin Key section.
  3. Copy your unique plugin key. This key is specific to your organization.
  4. 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.chat or http://localhost:4000 for local development).
  • pluginKey (required): Your organization's unique plugin key obtained from the dashboard.

Step 4: Verify Installation

  1. Save your HTML file and open it in a web browser.
  2. The Ulka Chat widget should appear on your page (typically in the bottom-right corner).
  3. Click the widget to open the chat interface.
  4. 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 apiBaseUrl is 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.