Skip to main content

Documentation Index

Fetch the complete documentation index at: https://sitegpt.ai/docs/llms.txt

Use this file to discover all available pages before exploring further.

SiteGPT provides multiple ways to integrate your chatbot into your applications and workflows.

Integration options

Embed your chatbot on any website with our lightweight JavaScript SDK.Features:
  • Easy installation with a single script tag
  • Customizable appearance and behavior
  • Programmatic control via JavaScript API
  • Event listeners for chatbot interactions
  • Mobile-responsive design
View SDK documentation

Getting started

1

Choose your integration method

Select the approach that best fits your use case: SDK for websites, API for custom apps, webhooks for real-time events, or integrations for no-code solutions.
2

Get your API key

Find your API key in your account settings. You’ll need this for API and webhook authentication.
3

Review documentation

Read the relevant documentation for your chosen integration method.
4

Test in development

Build and test your integration in a development environment before deploying to production.
5

Deploy

Once tested, deploy your integration to production and monitor its performance.

Common use cases

Website chatbot

Use the JavaScript SDK to add a chatbot to your website:
<script>
  window.$sitegpt = {
    chatbotId: "your-chatbot-id"
  };
</script>
<script src="https://sitegpt.ai/widget/your-chatbot-id.js" defer></script>
Learn more about the SDK

Custom application

Use the REST API to integrate chatbot functionality into your app:
const response = await fetch('https://sitegpt.ai/api/v0/chatbots/your-chatbot-id/message', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer your-api-key',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    message: 'Hello, chatbot!',
    threadId: 'optional-thread-id'
  })
});

const data = await response.json();
console.log(data.message);
View API reference

Real-time notifications

Use webhooks to receive instant notifications:
app.post('/webhooks/leads', (req, res) => {
  const { lead } = req.body;
  
  // Add lead to your CRM
  await crm.addLead({
    name: lead.name,
    email: lead.email,
    source: 'SiteGPT chatbot'
  });
  
  res.status(200).send('OK');
});
Learn about webhooks

No-code automation

Use Zapier to connect SiteGPT with other tools:
  1. New lead captured → Add to HubSpot
  2. Conversation escalated → Create Zendesk ticket
  3. Message sent → Log to Google Sheets
Explore Zapier integration

Authentication

API key

Your API key authenticates requests to the SiteGPT API. Finding your API key:
  1. Go to your account settings
  2. Navigate to API Keys
  3. Copy your API key
Using your API key:
curl https://sitegpt.ai/api/v0/chatbots \
  -H "Authorization: Bearer your-api-key"
Security:
  • Never expose your API key in client-side code
  • Store it securely in environment variables
  • Rotate it regularly
  • Use different keys for development and production

Webhook tokens

Webhook tokens verify that webhook requests come from SiteGPT. Setting webhook tokens:
  1. Go to Settings > Webhooks
  2. Enter a secure token for each webhook type
  3. Save your configuration
Verifying webhook tokens:
const token = req.headers['x-webhook-token'];
if (token !== process.env.SITEGPT_WEBHOOK_TOKEN) {
  return res.status(401).send('Unauthorized');
}

Rate limits

API requests are rate-limited to ensure fair usage:
  • Free plan: 100 requests/hour
  • Starter plan: 1,000 requests/hour
  • Pro plan: 10,000 requests/hour
  • Enterprise plan: Custom limits
Rate limit headers are included in API responses:
X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 999
X-RateLimit-Reset: 1640000000

Best practices

Error handling

Always implement proper error handling:
try {
  const response = await fetch(apiUrl, options);
  
  if (!response.ok) {
    throw new Error(`API error: ${response.status}`);
  }
  
  const data = await response.json();
  return data;
} catch (error) {
  console.error('API request failed:', error);
  // Handle error appropriately
}

Retry logic

Implement exponential backoff for failed requests:
async function fetchWithRetry(url, options, maxRetries = 3) {
  for (let i = 0; i < maxRetries; i++) {
    try {
      const response = await fetch(url, options);
      if (response.ok) return response;
      
      if (response.status >= 500) {
        // Server error, retry
        await sleep(Math.pow(2, i) * 1000);
        continue;
      }
      
      // Client error, don't retry
      throw new Error(`API error: ${response.status}`);
    } catch (error) {
      if (i === maxRetries - 1) throw error;
      await sleep(Math.pow(2, i) * 1000);
    }
  }
}

Caching

Cache API responses when appropriate:
const cache = new Map();

async function getChatbot(chatbotId) {
  if (cache.has(chatbotId)) {
    return cache.get(chatbotId);
  }
  
  const chatbot = await fetchChatbot(chatbotId);
  cache.set(chatbotId, chatbot);
  
  // Expire cache after 5 minutes
  setTimeout(() => cache.delete(chatbotId), 5 * 60 * 1000);
  
  return chatbot;
}

Logging

Log API interactions for debugging:
function logApiRequest(method, url, status, duration) {
  console.log({
    timestamp: new Date().toISOString(),
    method,
    url,
    status,
    duration: `${duration}ms`
  });
}

Support

Need help with your integration?
  • Documentation: Browse our comprehensive guides
  • API reference: Detailed endpoint documentation
  • Email support: support@sitegpt.ai
  • Community: Join our Slack community

Next steps

JavaScript SDK

Embed your chatbot on websites

REST API

Build custom integrations

Webhooks

Receive real-time notifications

Integrations

Connect with popular platforms