Skip to main content

Introduction

The Go React Scaffold includes optional integrations with popular third-party services to extend your application’s functionality. All integrations are located in the backend/integrations/ directory and can be enabled or disabled through environment variables.

Available Integrations

Payment Processing

  • Paypack - Mobile money payment gateway for Rwanda
    • Cash-in (receive payments)
    • Cash-out (send money)
    • Transaction status polling
    • Webhook support for payment notifications

Communication

  • Telegram Bot - Send notifications and alerts to Telegram
    • Simple message delivery
    • Error notifications
    • System alerts
  • Plunk Email - Transactional email service
    • Send emails programmatically
    • Custom reply-to addresses
    • Simple API integration

Enabling/Disabling Integrations

All integrations are optional and controlled via environment variables in your .env file:
# Paypack Payment Integration
PAYPACK_CLIENT_ID=your_client_id
PAYPACK_CLIENT_SECRET=your_client_secret

# Telegram Bot
TELEGRAM_BOT_ID=your_bot_token
TELEGRAM_CHAT_ID=your_chat_id

# Plunk Email
USE_PLUNK=your_plunk_api_key
If environment variables are not set, the integrations will fail silently or return errors. Only configure the integrations you actually need.

When to Use Each Integration

Paypack

Use Paypack when you need to:
  • Accept mobile money payments from Rwanda (MTN Mobile Money, Airtel Money)
  • Send money to mobile wallets
  • Build a marketplace or e-commerce platform
  • Process subscription payments

Telegram Bot

Use Telegram notifications when you need to:
  • Monitor critical system events in real-time
  • Receive alerts for errors or exceptions
  • Track user signups or important actions
  • Send notifications to your team

Plunk Email

Use Plunk for:
  • Transactional emails (password resets, confirmations)
  • User onboarding emails
  • Notifications and updates
  • Marketing emails

Integration Architecture

All integrations follow a simple pattern:
  1. Configuration: Environment variables are loaded via backend/configs/env.go
  2. Implementation: Each integration has its own file in backend/integrations/
  3. Usage: Import and call the integration functions from your handlers
import "backend/integrations"

// Example: Send a notification
integrations.SendTelegramMessage("Payment received!")

Security Considerations

Never commit your .env file with actual API keys. Use .env.example as a template and keep your credentials secure.
  • Store all API keys and secrets in environment variables
  • Use different credentials for development and production
  • Rotate API keys periodically
  • Monitor integration usage for suspicious activity
  • Validate all inputs before sending to external services

Error Handling

All integration functions return errors that should be handled appropriately:
err := integrations.SendEmailWithPlunk(body, recipient, subject, replyTo)
if err != nil {
    log.Printf("Failed to send email: %v", err)
    // Handle error appropriately
}

Next Steps

Build docs developers (and LLMs) love