Skip to main content

Getting Started with Communication Service

The Communication Service is a unified communication platform built with Elixir/Phoenix that handles email, SMS, and push notifications for all 1nga services.

Overview

The Communication Service provides:

  • Email - SMTP-based email sending with template support
  • SMS - Multi-provider SMS with automatic failover (Twilio, BulkSMS.com, AWS SNS)
  • Push Notifications - FCM (Android) and APNS (iOS)

Features

  • ✅ High concurrency and fault tolerance (Elixir/OTP)
  • ✅ Background job processing (Oban)
  • ✅ Template management
  • ✅ Multi-provider support with automatic failover
  • ✅ Retry logic with exponential backoff
  • ✅ Delivery tracking
  • ✅ Batch sending
  • ✅ Scheduled sending

Prerequisites

  • Elixir 1.16+
  • PostgreSQL 14+
  • Redis (for background jobs)
  • Docker (optional)

Quick Start

Local Development

# Navigate to communication service
cd shared/communication

# Install dependencies
mix deps.get

# Setup database
mix ecto.create
mix ecto.migrate

# Start the service
mix phx.server

Environment Variables

# Database
DATABASE_URL=postgresql://user:password@localhost:5432/communication_dev

# Redis (for Oban background jobs)
REDIS_URL=redis://localhost:6379

# Email Configuration
SMTP_HOST=smtp.example.com
SMTP_PORT=587
SMTP_USERNAME=your-email@example.com
SMTP_PASSWORD=your-password

# SMS Providers
TWILIO_ACCOUNT_SID=your-twilio-sid
TWILIO_AUTH_TOKEN=your-twilio-token
TWILIO_PHONE_NUMBER=+1234567890

# Push Notifications
FCM_SERVER_KEY=your-fcm-server-key
APNS_KEY_PATH=/path/to/apns-key.p8
APNS_KEY_ID=your-apns-key-id
APNS_TEAM_ID=your-apns-team-id

Service Endpoints

The Communication Service runs on port 8010 by default.

  • Health Check: GET http://localhost:8010/health
  • GraphQL Endpoint: POST http://localhost:8010/api/graphql
  • REST API: http://localhost:8010/api/v1/

Next Steps