FAQ - usmantahirr/infobip-notification-service GitHub Wiki

Frequently Asked Questions

General Questions

What is the Infobip Notification Service?

The Infobip Notification Service is a starter project that provides a simple and secure way to send email and SMS notifications using Infobip's API. It handles rate limiting, validation, error handling, and logging out of the box.

What are the main features?

Current features:

  • Email notifications with file attachments
  • SMS notifications
  • Rate limiting
  • Input validation
  • Error handling
  • Logging
  • Security headers
  • CORS configuration

Planned features:

  • Message queue integration
  • Database integration
  • Enhanced monitoring
  • Caching layer
  • Health check endpoints

What are the system requirements?

  • Node.js 18.x or later
  • npm 9.x or later
  • Infobip API credentials
  • (Optional) PostgreSQL 14.x or later
  • (Optional) Redis 6.x or later

Installation & Setup

How do I set up the service?

  1. Clone the repository:

    git clone https://github.com/usmantahirr/infobip-notification-service.git
    cd infobip-notification-service
  2. Install dependencies:

    npm install
  3. Set up environment:

    cp .env.example .env
    # Edit .env with your credentials

What environment variables do I need to set?

Required variables:

# Application
NODE_ENV=development
PORT=3000

# Infobip
INFOBIP_API_KEY=your_api_key
INFOBIP_BASE_URL=your_base_url
INFOBIP_SENDER_EMAIL=your_verified_sender_email
INFOBIP_SENDER_NUMBER=your_sender_number

# Rate Limiting
RATE_LIMIT_WINDOW=60000
RATE_LIMIT_MAX_REQUESTS=100

Optional variables:

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

# Redis
REDIS_URL=redis://localhost:6379

Usage

How do I send an email?

Using curl:

curl -X POST http://localhost:3000/api/v1/notifications/email \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "recipient": "[email protected]",
    "subject": "Welcome",
    "message": "Welcome to our platform!"
  }'

Using JavaScript/TypeScript:

const response = await fetch(
  "http://localhost:3000/api/v1/notifications/email",
  {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      Authorization: "Bearer YOUR_API_KEY",
    },
    body: JSON.stringify({
      recipient: "[email protected]",
      subject: "Welcome",
      message: "Welcome to our platform!",
    }),
  }
);

const data = await response.json();

How do I send an SMS?

Using curl:

curl -X POST http://localhost:3000/api/v1/notifications/sms \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "recipient": "+1234567890",
    "message": "Your verification code is: 123456"
  }'

Using JavaScript/TypeScript:

const response = await fetch("http://localhost:3000/api/v1/notifications/sms", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    Authorization: "Bearer YOUR_API_KEY",
  },
  body: JSON.stringify({
    recipient: "+1234567890",
    message: "Your verification code is: 123456",
  }),
});

const data = await response.json();

What are the rate limits?

  • 100 requests per minute per API key
  • Rate limit headers are included in responses:
    • X-RateLimit-Limit
    • X-RateLimit-Remaining
    • X-RateLimit-Reset

What file types are supported for email attachments?

Currently supported:

  • PDF
  • DOC
  • DOCX
  • JPG
  • PNG

Limitations:

  • Max file size: 2MB
  • Max 5 attachments per request

Error Handling

What error codes are available?

Code Description
VALIDATION_ERROR Request validation failed
AUTHENTICATION_ERROR Invalid or missing API key
RATE_LIMIT_ERROR Rate limit exceeded
INFOBIP_ERROR Error from Infobip API
INTERNAL_ERROR Internal server error

How do I handle errors?

try {
  await client.sendEmail({
    recipient: "[email protected]",
    subject: "Welcome",
    message: "Welcome to our platform!",
  });
} catch (error) {
  if (error.code === "VALIDATION_ERROR") {
    // Handle validation error
  } else if (error.code === "RATE_LIMIT_ERROR") {
    // Handle rate limit error
  } else {
    // Handle other errors
  }
}

Security

How is my API key protected?

  • API keys are stored in environment variables
  • Never commit API keys to version control
  • Use secure secret management in production

What security measures are in place?

Current:

  • API key authentication
  • Rate limiting
  • Security headers
  • CORS configuration
  • Input validation

Planned:

  • JWT support
  • OAuth2 integration
  • API key rotation
  • WAF integration
  • DDoS protection

Monitoring & Logging

What logging is available?

Current:

  • Winston logging
  • Basic error tracking
  • Rate limit monitoring

Planned:

  • Structured logging
  • Log aggregation
  • Log retention policies
  • Prometheus metrics
  • OpenTelemetry tracing

How do I monitor the service?

Current:

  • Check application logs
  • Monitor rate limits
  • Track error rates

Planned:

  • Prometheus metrics
  • Grafana dashboards
  • Health check endpoints
  • Performance monitoring
  • Distributed tracing

Deployment

How do I deploy the service?

Options:

  1. Docker
  2. Kubernetes
  3. AWS ECS
  4. Manual deployment

See the Deployment Guide for detailed instructions.

What are the resource requirements?

Minimum:

  • 1 CPU core
  • 512MB RAM
  • 1GB storage

Recommended:

  • 2 CPU cores
  • 1GB RAM
  • 5GB storage

Contributing

How can I contribute?

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Submit a pull request

See the Contributing Guidelines for detailed instructions.

What coding standards should I follow?

  • Use TypeScript
  • Follow existing code style
  • Write tests
  • Update documentation
  • Use conventional commits

Support

Where can I get help?

  • GitHub Issues
  • Documentation
  • Community chat
  • Email support

How do I report a bug?

  1. Check existing issues
  2. Create a new issue
  3. Provide:
    • Description
    • Steps to reproduce
    • Expected behavior
    • Actual behavior
    • Environment details

Future Plans

What features are planned?

High Priority:

  • Message queue integration
  • Database integration
  • Enhanced error handling

Medium Priority:

  • Caching layer
  • Health check endpoints
  • Metrics collection

Low Priority:

  • Advanced monitoring
  • A/B testing
  • Analytics dashboard

Last updated: March 2025

⚠️ **GitHub.com Fallback** ⚠️