# README
Webhook Multiplexer
Webhook Multiplexer is a Go-based application that allows you to create and manage webhooks, endpoints, and responses.
Table of Contents
Prerequisites
- Go 1.21.4 or later
- Docker and Docker Compose
- PostgreSQL 15.0 or later
- atlas-cli 0.1.0 or later
Installation
- Clone the repository:
git clone https://github.com/Sandy143toce/webhook-multiplexer.git
cd webhook-multiplexer
- Install the dependencies:
go mod download
Configuration
The application uses environment variables for configuration. These are set in the docker-compose.yml
file:
DB_USER
: PostgreSQL usernameDB_PASSWORD
: PostgreSQL passwordDB_NAME
: Database nameDB_HOST
: Database hostDB_PORT
: Database port
Running the Application
- Start the application and database using Docker Compose:
docker-compose up --build
- Once docker-compose is up and running, you need to run the migrations to create the tables in the database. First Replace the Database Variables like DB User, DB Password, DB Name, DB Host, DB Port in the URL in apply.sh file in schema folder. Then Give Acces to the apply.sh file by running the command chmod +x apply.sh. Then run the below command to apply the migrations.
cd schema
./apply.sh
- The application will be available at
http://localhost:9000
API Documentation
The application provides the following API endpoints:
- Create Webhook
- Method: POST
- URL:
/webhook-multiplexer/create-webhook
- Body:
{ "name": "webhook1", "url": "http://localhost:9000/webhook-multiplexer/send-event" }
- Map Endpoint to Master Webhook
- Method: POST
- URL:
/webhook-multiplexer/add-customer-endpoint
- Body:
{ "webhook_id": "id returned by create webhook api", "url": "any_url" }
- Send Event/Webhook Forwarding
- Method: POST
- URL:
/webhook-multiplexer/send-event
- Body:
{ "event_name": "event1", "metadata": json, // can send any data its optional }