๐Ÿš€ Assistant API - CDN Deployment Example

๐Ÿ“ฆ How to use from CDN

Load the Assistant API from your Cloudflare Pages URL:

<!-- Replace YOUR_CF_PAGES_URL with your actual Cloudflare Pages URL -->
<script src="https://YOUR_CF_PAGES_URL/assistant-api.iife.js"></script>

<script>
  // Use the API immediately
  window.assistantAPI.showChat({
    title: 'Support Chat',
    initialMessage: 'How can I help you?'
  });
</script>

๐Ÿงช Test the API

This example loads the API from the local build:

Check the browser console for detailed logs

๐Ÿ“‹ Integration Examples

WordPress/HTML Sites:

<script src="https://your-site.pages.dev/assistant-api.iife.js"></script>
<script>
  // Add to your existing JavaScript
  document.addEventListener('DOMContentLoaded', function() {
    // Show chat when page loads
    window.assistantAPI.showChat();
  });
</script>

React/Vue Apps:

// In your component
useEffect(() => {
  const script = document.createElement('script');
  script.src = 'https://your-site.pages.dev/assistant-api.iife.js';
  script.onload = () => {
    window.assistantAPI.showChat();
  };
  document.head.appendChild(script);
}, []);

๐Ÿ”ง File Sizes

IIFE version: ~24KB gzipped (recommended for script tags)

ES version: ~30KB raw (for modern bundlers)

โœ… Both versions are production-ready

๐ŸŒ Browser Support

IIFE version: IE11+, Chrome 60+, Firefox 60+, Safari 10+

ES version: Chrome 61+, Firefox 60+, Safari 10.1+

IIFE version has better compatibility for older browsers