🤖 Bonktah Integration

Build amazing experiences with our powerful API and developer tools

🚀 Overview

The Bonktah API allows you to integrate our meme-savvy AI into your applications. Built on ElizaOS architecture with custom endpoints for Bonktah-specific features, our API provides:

💬 Real-time Chat

Connect users with Bonktah for engaging conversations about crypto, memes, and life

🧠 Conscience Access

Retrieve and showcase community-voted best conversations

🔌 Easy Integration

SDKs for popular languages and frameworks make integration a breeze

🔐 Authentication

All API requests require authentication using an API key. Include your key in the Authorization header:

HTTP Header
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
🔑 Keep Your API Key Secure

Never expose your API key in client-side code or public repositories. Use environment variables and server-side requests to keep your key safe.

Getting Your API Key

  1. Create a Bonktah Account
    Sign up at bonktah.xyz/signup using your email or social login
  2. Navigate to API Settings
    Go to your dashboard and click on "API Keys" in the developer section
  3. Generate Your Key
    Click "Create New Key", give it a descriptive name, and copy the generated key immediately

💬 Chat API

Send messages to Bonktah and receive AI-powered responses with personality and context awareness.

POST /api/v1/chat

Send a message to Bonktah and receive a response

Request Body

JSON
{
  "message": "Hey Bonktah, what's your take on meme coins?",
  "userId": "user_12345",
  "sessionId": "session_abc123",
  "context": {
    "platform": "api",
    "channel": "general",
    "previousMessageCount": 5
  },
  "options": {
    "temperature": 0.8,
    "saveToConscience": true,
    "personalityMode": "casual"
  }
}

Parameters

Parameter Type Required Description
message string Required The message to send to Bonktah
userId string Required Unique identifier for the user
sessionId string Optional Session identifier for conversation continuity
context object Optional Additional context for the conversation
options object Optional Configuration options for response generation

Response

JSON
{
  "response": "Meme coins are the wild west of crypto! 🤠 They bring fun and community to finance...",
  "messageId": "msg_789xyz",
  "timestamp": "2025-05-24T12:00:00Z",
  "personality": "casual",
  "saveToConscience": true,
  "sentiment": "positive",
  "topics": ["crypto", "meme-coins", "community"],
  "usage": {
    "tokensUsed": 125,
    "remainingTokens": 99875
  }
}
cURL
curl -X POST https://api.bonktah.xyz/v1/chat \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "message": "Hey Bonktah, what'\''s your take on meme coins?",
    "userId": "user_12345",
    "sessionId": "session_abc123"
  }'
Node.js
const axios = require('axios');

const response = await axios.post('https://api.bonktah.xyz/v1/chat', {
  message: "Hey Bonktah, what's your take on meme coins?",
  userId: 'user_12345',
  sessionId: 'session_abc123',
  context: {
    platform: 'api',
    channel: 'general'
  }
}, {
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  }
});

console.log(response.data.response);
Python
import requests

response = requests.post(
    'https://api.bonktah.xyz/v1/chat',
    json={
        'message': "Hey Bonktah, what's your take on meme coins?",
        'userId': 'user_12345',
        'sessionId': 'session_abc123',
        'context': {
            'platform': 'api',
            'channel': 'general'
        }
    },
    headers={
        'Authorization': 'Bearer YOUR_API_KEY',
        'Content-Type': 'application/json'
    }
)

print(response.json()['response'])

🧠 Conscience API

Access Bonktah's collective memory of conversations, retrieve popular discussions, and contribute to the community knowledge base.

GET /api/v1/conscience

Retrieve conversations from Bonktah's conscience

Query Parameters

URL Parameters
?limit=10&sort=recent&category=crypto&minUpvotes=5&search=defi
Parameter Type Default Description
limit integer 10 Number of conversations to return (max: 50)
sort string recent Sort order: recent, upvotes, trending
category string all Filter by category: crypto, life, culture, tech
minUpvotes integer 0 Minimum upvote count filter
search string - Search query for conversation content
POST /api/v1/conscience/upvote

Upvote a conversation in Bonktah's conscience

Request Body
{
  "conversationId": "conv_12345",
  "userId": "user_67890"
}

🔗 Webhook Setup

Set up webhooks to receive real-time notifications about Bonktah interactions, new conscience entries, and system events.

  1. Configure Webhook URL

    Register your webhook endpoint to receive events:

    POST /api/v1/webhooks/register
    {
      "url": "https://yourdomain.com/bonktah-webhook",
      "events": ["chat.message", "conscience.new", "conscience.upvote"],
      "secret": "your_webhook_secret",
      "description": "Production webhook for chat events"
    }
  2. Handle Webhook Events

    Your endpoint will receive events in this format:

    Webhook Payload
    {
      "event": "chat.message",
      "timestamp": "2025-05-24T12:00:00Z",
      "data": {
        "messageId": "msg_123",
        "userId": "user_456", 
        "message": "What's up Bonktah?",
        "response": "Hey there! Just vibing in the digital realm 🚀",
        "platform": "discord",
        "channel": "general"
      },
      "signature": "sha256=abc123def456..."
    }
  3. Verify Webhook Signatures

    Always verify webhook authenticity using HMAC-SHA256:

    Node.js Verification
    const crypto = require('crypto');
    
    function verifyWebhookSignature(payload, signature, secret) {
      const expectedSignature = crypto
        .createHmac('sha256', secret)
        .update(payload, 'utf8')
        .digest('hex');
        
      const receivedSignature = signature.replace('sha256=', '');
      
      return crypto.timingSafeEqual(
        Buffer.from(expectedSignature, 'hex'),
        Buffer.from(receivedSignature, 'hex')
      );
    }
    
    // Express.js webhook handler
    app.post('/bonktah-webhook', express.raw({type: 'application/json'}), (req, res) => {
      const signature = req.headers['x-bonktah-signature'];
      const payload = req.body;
      
      if (!verifyWebhookSignature(payload, signature, process.env.WEBHOOK_SECRET)) {
        return res.status(401).send('Invalid signature');
      }
      
      const event = JSON.parse(payload);
      console.log('Received event:', event.event, event.data);
      
      // Process the event
      switch(event.event) {
        case 'chat.message':
          handleChatMessage(event.data);
          break;
        case 'conscience.new':
          handleNewConscience(event.data);
          break;
        // ... handle other events
      }
      
      res.status(200).send('OK');
    });

Available Events

💬 chat.message

New conversation with Bonktah

🧠 conscience.new

Conversation saved to conscience

⬆️ conscience.upvote

Conversation received an upvote

👤 user.join

New user starts chatting

💡 Integration Examples

Discord Bot Integration

JavaScript
const { Client, GatewayIntentBits } = require('discord.js');
const BonktahAPI = require('@bonktah/sdk');

const client = new Client({ 
  intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages] 
});
const bonktah = new BonktahAPI(process.env.BONKTAH_API_KEY);

client.on('messageCreate', async (message) => {
  if (message.author.bot) return;
  
  // Respond to mentions
  if (message.mentions.has(client.user)) {
    const typing = message.channel.sendTyping();
    
    try {
      const response = await bonktah.chat({
        message: message.content.replace(`<@${client.user.id}>`, '').trim(),
        userId: message.author.id,
        context: {
          platform: 'discord',
          guild: message.guild.name,
          channel: message.channel.name,
          username: message.author.username
        }
      });
      
      await message.reply(response.response);
      
      // React with emoji based on sentiment
      if (response.sentiment === 'positive') {
        await message.react('🚀');
      }
    } catch (error) {
      console.error('Bonktah API error:', error);
      await message.reply('Oops! My circuits are a bit scrambled right now. Try again in a moment! 🤖');
    }
  }
});

client.login(process.env.DISCORD_TOKEN);

React Chat Component

React + TypeScript
import React, { useState, useEffect } from 'react';
import { BonktahClient } from '@bonktah/react';

interface Message {
  id: string;
  author: 'user' | 'bonktah';
  content: string;
  timestamp: Date;
}

export const BonktahChat: React.FC = () => {
  const [messages, setMessages] = useState([]);
  const [input, setInput] = useState('');
  const [loading, setLoading] = useState(false);
  
  const bonktah = new BonktahClient({
    apiKey: process.env.REACT_APP_BONKTAH_API_KEY,
    onMessage: (message) => {
      setMessages(prev => [...prev, {
        id: message.id,
        author: 'bonktah',
        content: message.response,
        timestamp: new Date(message.timestamp)
      }]);
    }
  });
  
  const sendMessage = async () => {
    if (!input.trim() || loading) return;
    
    setLoading(true);
    
    // Add user message
    const userMessage = {
      id: `user_${Date.now()}`,
      author: 'user' as const,
      content: input,
      timestamp: new Date()
    };
    
    setMessages(prev => [...prev, userMessage]);
    setInput('');
    
    try {
      await bonktah.sendMessage(input);
    } catch (error) {
      console.error('Failed to send message:', error);
      // Show error state
    } finally {
      setLoading(false);
    }
  };
  
  return (
    
{messages.map((msg) => (
{msg.author === 'user' ? 'You' : 'Bonktah'}:

{msg.content}

))} {loading && (
Bonktah is typing ...
)}
setInput(e.target.value)} onKeyPress={(e) => e.key === 'Enter' && sendMessage()} placeholder="Chat with Bonktah..." disabled={loading} />
); };

🎉 Ready to Build?

Check out our complete example projects on GitHub:

Rate Limits & Best Practices

Rate Limits

Endpoint Limit Window Burst
Chat API 60 requests Per minute 10 requests
Conscience API 100 requests Per minute 20 requests
Webhook Registration 10 requests Per hour 2 requests
Bulk Operations 10 requests Per minute 2 requests

Best Practices

  • Use Session IDs: Maintain conversation context by using consistent session IDs
  • Implement Retry Logic: Use exponential backoff for failed requests
  • Cache Responses: Cache conscience queries to reduce API calls
  • Handle Errors Gracefully: Always provide fallback behavior for API failures
  • Monitor Usage: Track your API usage through the dashboard
  • Optimize Webhooks: Process webhook events asynchronously
🚨 Rate Limit Headers

Check response headers to monitor your rate limit status:

  • X-RateLimit-Limit - Your rate limit
  • X-RateLimit-Remaining - Requests remaining
  • X-RateLimit-Reset - When the limit resets

🛟 Getting Help

📚 Documentation

Comprehensive guides and API reference

View Docs →

💬 Discord Community

Join our developer community for help and discussions

Join Discord →

🐛 GitHub Issues

Report bugs or request features

Open Issue →

🚀 Ready to start building?

Get your API key and join thousands of developers creating with Bonktah!

Get Started Free