Custom Endpoint Documentation
Step 1: Set Up Your Custom Endpoint
Direct your custom endpoint (e.g., https://customendpoint.com (opens in a new tab)) to point to https://swalekh.reverieinc.com/server (opens in a new tab)
Step 2: Access the SDK
After step 1 the Swalekh SDK will be available at:
https://customendpoint.com/swalekh.js
Step 3: Load the SDK
Include the Swalekh SDK in your HTML by adding this script tag to your page:
<script src="https://customendpoint.com/swalekh.js"></script>
Then call the loadSwalekh()
function when your page loads:
document.addEventListener('DOMContentLoaded', loadSwalekh);
Step 4: Implement the SDK
Add the following JavaScript snippet to your webpage to initialize Swalekh:
const validationKey = "YOUR-VALIDATION-KEY"; // Replace with your actual validation key
const loadSwalekh = async () => {
await window.initSwalekh({
validationKey,
customEndpoint: 'https://customendpoint.com',
creds: {
querySel: "#swalekh-textarea3", // Selector for your textarea
lang: "hi", // Language for transliteration (e.g., Hindi)
mode: "phonetic", // Input mode (e.g., phonetic)
},
});
};
Troubleshooting
If you encounter any issues:
- Verify your validation key is correct
- Ensure your custom endpoint is properly configured
- Check that the textarea selector matches an element on your page
- Confirm the SDK is loading correctly (check browser console for errors)
For additional support, please join our Discord (opens in a new tab).