Skip to main content

Available Adapters

What are Adapters?

Adapters connect the Router SDK to messaging platforms. Each adapter:
  • Receives messages from the platform
  • Normalizes message format
  • Sends responses back to the platform
  • Handles platform-specific features

Using Adapters

Import and configure adapters:
import { Router, DiscordAdapter, TelegramAdapter } from '@boostgpt/router';

const router = new Router({
  apiKey: process.env.BOOSTGPT_API_KEY,
  projectId: process.env.BOOSTGPT_PROJECT_ID,
  defaultBotId: process.env.BOOSTGPT_BOT_ID,
  adapters: [
    new DiscordAdapter({
      discordToken: process.env.DISCORD_TOKEN
    }),
    new TelegramAdapter({
      telegramToken: process.env.TELEGRAM_TOKEN
    })
  ]
});

await router.start();

Multi-Platform Deployment

Deploy to multiple platforms with one codebase:
import {
  Router,
  DiscordAdapter,
  TelegramAdapter,
  SlackAdapter
} from '@boostgpt/router';

const router = new Router({
  apiKey: process.env.BOOSTGPT_API_KEY,
  projectId: process.env.BOOSTGPT_PROJECT_ID,
  defaultBotId: process.env.BOOSTGPT_BOT_ID,
  adapters: [
    new DiscordAdapter({
      discordToken: process.env.DISCORD_TOKEN
    }),
    new TelegramAdapter({
      telegramToken: process.env.TELEGRAM_TOKEN
    }),
    new SlackAdapter({
      slackToken: process.env.SLACK_TOKEN,
      signingSecret: process.env.SLACK_SIGNING_SECRET
    })
  ]
});

router.onMessage(async (message, context) => {
  // Same handler works across all platforms
  if (message.content === '/help') {
    return 'I can help you! Ask me anything.';
  }
  return null;
});

await router.start();
console.log('Bot running on Discord, Telegram, and Slack!');

Platform-Specific Logic

Handle platform differences when needed:
router.onMessage(async (message, context) => {
  if (message.platform === 'discord') {
    return 'Discord response with <@user> mentions';
  }

  if (message.platform === 'telegram') {
    return 'Telegram response with /commands';
  }

  if (message.platform === 'slack') {
    return 'Slack response with <@U123> format';
  }

  // Default response for all platforms
  return null;
});

Adapter Configuration

Each adapter has specific configuration:

Discord

new DiscordAdapter({
  discordToken: 'your-discord-bot-token'
})

Telegram

new TelegramAdapter({
  telegramToken: 'your-telegram-bot-token'
})

Slack

new SlackAdapter({
  slackToken: 'xoxb-your-slack-token',
  signingSecret: 'your-signing-secret'
})

WhatsApp

new WhatsAppAdapter({
  phoneNumberId: 'your-phone-number-id',
  accessToken: 'your-access-token',
  verifyToken: 'your-verify-token'
})

Crisp

new CrispAdapter({
  identifier: 'your-identifier',
  key: 'your-key'
})

Getting Platform Credentials

Next Steps

Choose your platform to get started: