Skip to content

Latest commit

 

History

13 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Primest Lead Webhook

Django integration service for receiving, validating, transforming, and forwarding lead data.

Overview

This project demonstrates a production-style webhook pipeline: an incoming lead is validated against business rules, normalized through a configurable attribute mapping, and forwarded to an external API with a structured result.

Processing flow

  1. Receive a lead through the webhook endpoint.
  2. Check eligibility rules such as postcode and property ownership.
  3. Normalize customer attributes with a JSON mapping.
  4. Remove invalid optional attributes and report them as dropped fields.
  5. Forward eligible data to the configured downstream API.
  6. Return a clear success, rejection, or error response.

Engineering highlights

  • Mapping-driven validation instead of hard-coded payload shapes
  • Environment-based credentials and endpoint configuration
  • Explicit handling of eligible, rejected, and partially valid leads
  • Separation between webhook transport, business rules, and downstream delivery
  • Local integration workflow suitable for tunnel-based webhook testing

Technology

Python 3.10+, Django 5.2, Requests, JSON configuration, REST APIs, webhooks, and ngrok for local integration testing.

Configuration

The service reads external credentials and endpoints from environment variables:

Variable Purpose
CUSTOMER_TOKEN Authentication token for the downstream API
RECEIVE_URL Downstream lead receiver URL
PRODUCT_NAME Product identifier; defaults to solar
CUSTOMER_ATTRIBUTE_MAPPING Optional path to the attribute mapping file

Never commit real credentials to the repository.

Run locally

python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
python manage.py migrate
python manage.py runserver

Send a test POST request to the lead webhook endpoint using synthetic data and environment-based credentials.

What this project shows

The repository highlights practical backend integration work: defensive input handling, configurable transformation rules, external API delivery, and traceable webhook responses.

License

GPL-3.0.

About

Django webhook service for validating, transforming, and forwarding lead data.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages