Skip to main content

Telegram Bot Integration

The M.O.N.K.Y Telegram Bot provides a seamless way to interact with your Solana wallet directly from Telegram. Our bot API allows developers to integrate wallet functionality, notifications, and user interactions.

Bot Information

Bot Username: @monky_os_bot
Bot API Endpoint: https://api.monkywallet.com/v1/telegram

Getting Started

1. Start the Bot

Begin by starting a conversation with our bot:

Start Chat

Click here to start chatting with M.O.N.K.Y Bot

2. Available Commands

Initializes the bot and creates your user profileUsage: /startResponse: Welcome message with available commands
Access wallet-related functionsUsage: /wallet [action]Actions:
  • balance - Check wallet balance
  • address - Get wallet address
  • new - Create new wallet
Example: /wallet balance
Send SOL or tokens to another addressUsage: /send [amount] [token] [address]Example: /send 0.1 SOL 9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM
Get real-time token pricesUsage: /price [token]Example: /price SOL
Manage SOL stakingUsage: /stake [action] [amount]Actions:
  • delegate [amount] - Stake SOL
  • undelegate [amount] - Unstake SOL
  • rewards - Check staking rewards
Example: /stake delegate 1
Configure transaction and price alertsUsage: /notifications [action]Actions:
  • on - Enable notifications
  • off - Disable notifications
  • settings - View current settings
Display help information and support optionsUsage: /help [topic]Topics:
  • commands - List all commands
  • security - Security best practices
  • api - API access information

Bot API Integration

Authentication

To integrate with the bot programmatically, you’ll need a bot token:
1

Request Bot Access

Send /api command to the bot to request developer access
2

Verify Identity

Complete identity verification process
3

Receive Token

Get your bot integration token via secure message

Send Message API

Send messages to users via the bot:
POST /v1/telegram/send-message
Content-Type: application/json
Authorization: Bearer YOUR_BOT_TOKEN

{
  "chat_id": "USER_TELEGRAM_ID",
  "message": "Your transaction has been confirmed!",
  "parse_mode": "Markdown"
}
Response:
{
  "success": true,
  "data": {
    "message_id": 12345,
    "sent_at": "2024-10-24T07:37:42Z"
  }
}

Execute Command API

Execute bot commands programmatically:
POST /v1/telegram/execute-command
Content-Type: application/json
Authorization: Bearer YOUR_BOT_TOKEN

{
  "chat_id": "USER_TELEGRAM_ID",
  "command": "/wallet balance",
  "silent": false
}
Response:
{
  "success": true,
  "data": {
    "command": "/wallet balance",
    "response": "💰 **Wallet Balance**\nSOL: 5.24\nUSDC: 1,250.00",
    "executed_at": "2024-10-24T07:37:42Z"
  }
}

User Registration API

Check if a user is registered with the bot:
GET /v1/telegram/user/{telegram_id}
Authorization: Bearer YOUR_BOT_TOKEN
Response:
{
  "success": true,
  "data": {
    "telegram_id": "123456789",
    "username": "@user123",
    "registered_at": "2024-10-20T10:30:00Z",
    "wallet_connected": true,
    "notifications_enabled": true
  }
}

Webhook Integration

Set up webhooks to receive bot events in real-time:

Configuration

POST /v1/telegram/webhook
Content-Type: application/json
Authorization: Bearer YOUR_BOT_TOKEN

{
  "url": "https://your-app.com/webhook/telegram",
  "events": [
    "message.received",
    "command.executed", 
    "user.registered",
    "wallet.connected"
  ],
  "secret": "your-webhook-secret"
}

Event Types

Triggered when a user sends a message to the bot
{
  "event": "message.received",
  "data": {
    "chat_id": "123456789",
    "username": "@user123",
    "message": "Hello bot!",
    "timestamp": "2024-10-24T07:37:42Z"
  }
}
Triggered when a user executes a bot command
{
  "event": "command.executed",
  "data": {
    "chat_id": "123456789",
    "command": "/wallet balance",
    "success": true,
    "response": "Balance: 5.24 SOL",
    "timestamp": "2024-10-24T07:37:42Z"
  }
}
Triggered when a new user starts using the bot
{
  "event": "user.registered",
  "data": {
    "chat_id": "123456789",
    "username": "@newuser",
    "first_name": "John",
    "registered_at": "2024-10-24T07:37:42Z"
  }
}
Triggered when a user connects their wallet
{
  "event": "wallet.connected",
  "data": {
    "chat_id": "123456789",
    "wallet_address": "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM",
    "connected_at": "2024-10-24T07:37:42Z"
  }
}

Bot Features

Security Features

🔐 Encrypted Storage

All sensitive data is encrypted before storage

🔑 Private Key Security

Private keys never leave your device

✅ Transaction Verification

All transactions require explicit confirmation

🚨 Fraud Detection

AI-powered fraud detection and alerts

Notification Types

The bot can send various types of notifications:
  • Transaction Alerts
  • Price Alerts
  • Staking Rewards
  • Incoming Transactions: Get notified when you receive tokens
  • Outgoing Confirmations: Confirmation when your transactions are processed
  • Failed Transactions: Alerts for failed or rejected transactions
  • Large Transactions: Special alerts for transactions above your threshold

Example Integration

Here’s a complete example of integrating the M.O.N.K.Y bot into your application:
class MonkyBotIntegration {
  constructor(botToken) {
    this.botToken = botToken;
    this.baseUrl = 'https://api.monkywallet.com/v1/telegram';
  }

  async sendWelcomeMessage(chatId, userName) {
    const response = await fetch(`${this.baseUrl}/send-message`, {
      method: 'POST',
      headers: {
        'Authorization': `Bearer ${this.botToken}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        chat_id: chatId,
        message: `🎉 Welcome to M.O.N.K.Y, ${userName}!\n\nYour Solana wallet is ready. Type /help to get started.`,
        parse_mode: 'Markdown'
      })
    });
    
    return response.json();
  }

  async checkUserWallet(chatId) {
    const response = await fetch(`${this.baseUrl}/execute-command`, {
      method: 'POST',
      headers: {
        'Authorization': `Bearer ${this.botToken}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        chat_id: chatId,
        command: '/wallet balance',
        silent: false
      })
    });
    
    return response.json();
  }

  async setupNotifications(chatId, events) {
    const response = await fetch(`${this.baseUrl}/user/${chatId}/notifications`, {
      method: 'PUT',
      headers: {
        'Authorization': `Bearer ${this.botToken}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        enabled: true,
        events: events
      })
    });
    
    return response.json();
  }
}

// Usage
const bot = new MonkyBotIntegration('your-bot-token');

// Send welcome message to new user
await bot.sendWelcomeMessage('123456789', '@newuser');

// Check wallet balance
const balance = await bot.checkUserWallet('123456789');

// Enable notifications
await bot.setupNotifications('123456789', [
  'transaction.received',
  'price.alert',
  'stake.reward'
]);

Rate Limits

Bot API calls are subject to rate limiting:
  • Free Tier: 50 requests/hour per bot token
  • Pro Tier: 500 requests/hour per bot token
  • Message Sending: 30 messages/minute per user

Support

Need help with bot integration?
Security Note: Never share your bot token publicly. Keep it secure and rotate it regularly.
I