SalesForge API is a service for managing email sequences and steps within those sequences. It provides functionality to add, update, and delete sequences and steps.
- Go 1.22.5+
- PostgreSQL
- Docker
internal/models: Contains the data models.internal/persistence: Contains the repository layer for database interactions.internal/service: Contains the service layer for business logic.internal/psql: Contains the PostgreSQL connection setup.config: Contains configuration files.
- Ensure PostgreSQL is installed and running.
- Create a database for the project.
- Run the
init.sqlscript to create the necessary tables and prepopulate them with sample data.
Create a configuration file config.yaml inside config directory with the following structure:
ServiceName: "salesforge-api"
Environment: "dev"
Server:
AppServerPort: 8080
HealthcheckPort: 8081
JWTAuthentication: false
Psql:
Db: "postgres"
User: "yourusername"
Pass: "yourpassword"
Host: "localhost"
Port: 5432
TestDB: #For running functional tests
Db: "postgres"
User: "yourusername"
Pass: "yourpassword"
Host: "localhost"
Port: 5433
Logger:
Level: "info" #debug
Format: "json" #consoleTo run the SalesForge API project, follow these steps:
- Clone the repository:
git clone - Navifate to its directory:
cd salesforge-api - Build and run the project using the Makefile:
make
To run the tests, use make test command:
make testYou will need test database credentials in the configuration file.
- Endpoint:
/v1/sequence - Method:
POST - Payload:
{ "account_id": 6789, "sequence_name": "New Welcome Sequence!", "sequence_open_tracking_enabled": true, "sequence_click_tracking_enabled": false, "steps": [ { "step_email_subject": "Welcome to our service", "step_email_body": "Thank you for joining us!", "wait_days": 1, "eligible_start_time": 1737621878, "eligible_end_time": 1737631081 }, { "step_email_subject": "Getting Started", "step_email_body": "Here are some tips to get started.", "wait_days": 2, "eligible_start_time": 1737751081, "eligible_end_time": 1737791222 } ] }
- Endpoint:
/v1/sequence - Method:
PUT - Payload:
{ "account_id": 6789, "sequence_id": 2, "sequence_open_tracking_enabled": false, "sequence_click_tracking_enabled": true }
- Endpoint:
/v1/step - Method:
PUT - Payload:
{ "account_id": 1, "step_id": 1, "sequence_id": 1, "step_email_subject": "Welcome to our service!", "step_email_body": "Thank you for joining us." }
- Endpoint:
/v1/step - Method:
DELETE - Payload:
{ "account_id": 12345, "step_id": 67890, "sequence_id": 11223 }
-
UUID:
- Consider using UUIDs for unique identifiers instead of integers.
- Consider adding support for UUID generation in the database.
-
Testing:
- Consider implementing end-to-end tests for API endpoints.
This project is licensed under the MIT License.