Sign inSign up

getflow/feedback-service

By getflow

Updated about 2 months ago

Service to forward feedback messages to Telegram

Image
0

466

getflow/feedback-service repository overview

Feedback Service

Service to forward feedback messages to Telegram or MAX Messenger.

License: GPL v2 Go Docker

Overview

feedback-service is a lightweight Go HTTP service that receives feedback submissions via a REST API and forwards them as formatted messages to a bot channel on Telegram or MAX Messenger. It is designed to be embedded into any web application as a backend for a contact/feedback form.

Features
  • Simple REST API — one POST /feedback endpoint accepting JSON payloads
  • Multi-platform bot support — switch between Telegram and MAX Messenger via environment variable
  • Docker-ready — multi-stage build with UPX compression, ready for containerized deployment
  • CI/CD integrated — GitLab CI pipeline for automated build and Docker image publishing

Project Structure

.
├── main.go                  # Entry point, HTTP server, Feedback struct
├── internal/
│   └── bot/
│       ├── factory.go       # Bot factory (Telegram / MAX)
│       ├── interface.go     # Bot interface definition
│       ├── tg.go            # Telegram bot implementation
│       ├── max.go           # MAX Messenger bot implementation
│       └── models/
│           └── command.go   # Command model (ChatID + Text)
├── Dockerfile
├── .gitlab-ci.yml
├── go.mod
└── go.sum

Quick Start

Prerequisites
Running Locally
# Set required environment variables
export FB_TOKEN="your-bot-token"
export FB_BOT_TYPE="BOT_TG"          # or "BOT_MAX"
export FB_CHANNEL="123456789"    # target chat/channel ID
export FB_PORT="3000"

# For MAX Messenger, also set:
export CERT_PEM="$(cat path/to/cert.pem)"

# Start the server
go run main.go
Building with Docker
docker build -t getflow/feedback-service:latest .
docker run -p 3000:3000 \
  -e FB_TOKEN=your-bot-token \
  -e FB_BOT_TYPE=TG \
  -e FB_CHANNEL=123456789 \
  getflow/feedback-service:latest

API Reference

POST /feedback

Submits a feedback message. The service formats the data and sends it to the configured bot channel.

Request Body (application/json):

{
  "name": "John Doe",
  "company": "Acme Corp",
  "phone": "+1234567890",
  "email": "[email protected]",
  "message": "I have a question about your service."
}
FieldTypeRequiredDescription
namestringYesSender's name
companystringNoSender's company
phonestringNoSender's phone number
emailstringNoSender's email address
messagestringYesFeedback message body

Responses:

Status CodeDescription
200 OKFeedback accepted and forwarded successfully
400 Bad RequestInvalid JSON payload
500 Internal Server ErrorFailed to send message to bot channel

Example (curl):

curl -X POST http://localhost:3000/feedback \
  -H "Content-Type: application/json" \
  -d '{
    "name": "John Doe",
    "company": "Acme Corp",
    "phone": "+1234567890",
    "email": "[email protected]",
    "message": "I love your product!"
  }'

Environment Variables

VariableRequiredDescription
FB_TOKENYesBot API token (Telegram or MAX)
FB_BOT_TYPEYesBot platform: BOT_TG (Telegram) or BOT_MAX
FB_CHANNELYesTarget chat / channel ID for message delivery
FB_PORTNoHTTP server port (default: 3000)
CERT_PEMConditionalCA certificate in PEM format (required for MAX)

CI/CD

This project uses GitLab CI. The pipeline includes:

  1. docs — Publishes the README to Docker Hub
  2. build — Builds the Docker image and pushes it to Docker Hub

License

This project is licensed under the GNU General Public License v2.0.

Author

Getflow Techgithub.com/getflow

Tag summary

Content type

Image

Digest

sha256:0177b843a

Size

5.9 MB

Last updated

about 2 months ago

docker pull getflow/feedback-service