Back to Blog Developer

API Integration Guide: Connect Kulcho to Your Stack

Jordan Taylor Jordan Taylor
API Integration Guide: Connect Kulcho to Your Stack

API Integration Guide: Connect Kulcho to Your Stack

One of Kulcho’s most powerful features is its comprehensive API. Whether you’re building custom features, automating workflows, or integrating with other tools, our APIs give you complete control. This guide will walk you through everything you need to know.

Getting Started with Kulcho APIs

Authentication

All API requests require authentication using API keys. Here’s how to get started:

// Get your API key from your dashboard
const API_KEY = 'your_api_key_here';

// Include it in all requests
const headers = {
  'Authorization': `Bearer ${API_KEY}`,
  'Content-Type': 'application/json'
};

Base URL

All API endpoints are accessed via:

https://api.kulcho.com/v1/

Core API Endpoints

User Management

Get User Profile

fetch('https://api.kulcho.com/v1/users/me', {
  headers: headers
})
.then(res => res.json())
.then(data => console.log(data));

Update User

fetch('https://api.kulcho.com/v1/users/me', {
  method: 'PATCH',
  headers: headers,
  body: JSON.stringify({
    name: 'New Name',
    bio: 'Updated bio'
  })
});

Content Management

Create Post

fetch('https://api.kulcho.com/v1/posts', {
  method: 'POST',
  headers: headers,
  body: JSON.stringify({
    title: 'My Post',
    content: 'Post content here',
    published: true,
    tags: ['announcement', 'update']
  })
});

List Posts

fetch('https://api.kulcho.com/v1/posts?limit=20&offset=0', {
  headers: headers
})
.then(res => res.json())
.then(posts => console.log(posts));

Community Management

Get Community Stats

fetch('https://api.kulcho.com/v1/community/stats', {
  headers: headers
})
.then(res => res.json())
.then(stats => {
  console.log(`Members: ${stats.total_members}`);
  console.log(`Active this month: ${stats.active_members}`);
});

Common Integration Patterns

1. Automated Welcome Sequences

When a new member joins, trigger a welcome sequence:

// Webhook handler for new members
app.post('/webhooks/new-member', async (req, res) => {
  const { user_id, email, name } = req.body;
  
  // Send welcome message
  await fetch('https://api.kulcho.com/v1/messages', {
    method: 'POST',
    headers: headers,
    body: JSON.stringify({
      recipient_id: user_id,
      subject: 'Welcome to the community!',
      content: `Hi ${name}, we're excited to have you!`
    })
  });
  
  // Assign onboarding role
  await fetch(`https://api.kulcho.com/v1/users/${user_id}/roles`, {
    method: 'POST',
    headers: headers,
    body: JSON.stringify({
      role: 'new_member'
    })
  });
  
  res.status(200).send('OK');
});

2. Custom Analytics Dashboard

Build a custom dashboard pulling data from Kulcho:

async function getDashboardData() {
  // Fetch multiple metrics in parallel
  const [stats, recentPosts, topMembers] = await Promise.all([
    fetch('https://api.kulcho.com/v1/community/stats', { headers }),
    fetch('https://api.kulcho.com/v1/posts?limit=5', { headers }),
    fetch('https://api.kulcho.com/v1/members?sort=engagement', { headers })
  ]);
  
  return {
    stats: await stats.json(),
    recentPosts: await recentPosts.json(),
    topMembers: await topMembers.json()
  };
}

3. Third-Party Integrations

Connect Kulcho to other tools in your stack:

Slack Notifications

// Post to Slack when someone joins
async function notifySlack(member) {
  await fetch(process.env.SLACK_WEBHOOK_URL, {
    method: 'POST',
    body: JSON.stringify({
      text: `New member: ${member.name} just joined!`
    })
  });
}

Webhooks

Subscribe to real-time events:

// Register a webhook
fetch('https://api.kulcho.com/v1/webhooks', {
  method: 'POST',
  headers: headers,
  body: JSON.stringify({
    url: 'https://yoursite.com/webhook',
    events: ['member.created', 'post.published'],
    secret: 'your_webhook_secret'
  })
});

Verify Webhook Signatures

const crypto = require('crypto');

function verifyWebhook(payload, signature, secret) {
  const hmac = crypto.createHmac('sha256', secret);
  const digest = hmac.update(payload).digest('hex');
  return signature === digest;
}

What’s Next?

Now that you understand the basics, here are some ideas:

  1. Build a custom mobile app using our APIs
  2. Create automated workflows with webhooks
  3. Integrate with your existing tools
  4. Build custom analytics dashboards
  5. Automate community management tasks

The possibilities are endless. Start building and let us know what you create!

API Integration Development Technical Guide