这是indexloc提供的服务,不要输入任何密码
Skip to content

yusuf-eren/lets-go-case

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Insider Message Sending System

A simple automatic message sending system built with Go.

Architecture Note

This implementation is kept in a single file for simplicity and easy demonstration. In a production environment, I would structure it with:

  • Separate packages (handlers, services, models)
  • Database layer (PostgreSQL/MySQL)
  • Redis caching for messageId storage
  • Proper logging and error handling
  • Configuration management
  • Unit tests

I also put the environment variables to the .env file for you to test the service without having to set the environment variables manually. I removed the auth key for security reasons and put a placeholder.

Installation & Run

# Clone and run
git clone https://github.com/yusuf-eren/lets-go-case
cd lets-go-case
go mod tidy
go run main.go

Configuration

Set environment variables:

export WEBHOOK_URL="https://webhook.site/02d3e3cd-8388-43e8-8687-586291bb6127"
export INS_AUTH_KEY="auth-key"
export BATCH_SIZE=2
export SEND_INTERVAL_MIN=2
export MESSAGE_CHAR_LIMIT=500
export PORT=8080

API Endpoints

  • GET /start - Start message sending
  • GET /stop - Stop message sending
  • GET /sent - Get all messages with status

Behavior

  • Sends all unsent messages immediately on startup
  • Then sends 2 messages every 2 minutes
  • Messages are marked as sent to prevent duplicates

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages