Examples & Templates

Ready-to-use bot configurations

Get started quickly with these pre-configured bot templates and code examples. Each example includes recommended modules, configuration settings, and implementation tips.

Bot Templates

Community Bot

Beginner

Full-featured community management bot with moderation, welcome messages, and analytics.

welcomeanti spamwarningsanalytics

Security Bot

Intermediate

Advanced security bot with captcha, anti-raid, and user verification.

captchaanti flooduser verificationban management

E-commerce Bot

Advanced

Complete shopping experience with product catalog and Stripe payments.

product catalogshopping cartpayment gatewayorder tracking

AI Assistant

Intermediate

Intelligent assistant with GPT-4 chat and image generation.

ai chatai image gensentiment analysis

Gaming Community

Intermediate

Gamification features with leaderboards, XP system, and achievements.

gamificationreputationleaderboardspolls

Course Platform

Advanced

Educational platform with courses, quizzes, and progress tracking.

course deliveryquiz assessmentprogress trackingai tutor

Code Examples

API Authentication

import axios from 'axios';

const api = axios.create({
  baseURL: 'https://api.botlaunch.io',
  headers: {
    'Authorization': `Bearer ${process.env.BOTLAUNCH_TOKEN}`,
    'x-organization-id': process.env.ORG_ID
  }
});

// Get bot details
const bot = await api.get('/api/bots/bot_123');

Webhook Handler

import crypto from 'crypto';

function verifyWebhook(payload: string, signature: string) {
  const expected = crypto
    .createHmac('sha256', process.env.WEBHOOK_SECRET!)
    .update(payload)
    .digest('hex');

  return crypto.timingSafeEqual(
    Buffer.from(signature),
    Buffer.from(`sha256=${expected}`)
  );
}

Module Configuration

// Enable anti-spam for a group
await api.patch('/api/bot-modules/groups/grp_123/anti_spam', {
  enabled: true,
  config: {
    floodLimit: 5,
    floodInterval: 10,
    blockLinks: true,
    action: 'warn_then_mute'
  }
});

More Examples on GitHub

Find more code examples, starter templates, and community contributions in our GitHub repository.

View on GitHub