Django integration service for receiving, validating, transforming, and forwarding lead data.
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.
- Receive a lead through the webhook endpoint.
- Check eligibility rules such as postcode and property ownership.
- Normalize customer attributes with a JSON mapping.
- Remove invalid optional attributes and report them as dropped fields.
- Forward eligible data to the configured downstream API.
- Return a clear success, rejection, or error response.
- 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
Python 3.10+, Django 5.2, Requests, JSON configuration, REST APIs, webhooks, and ngrok for local integration testing.
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.
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
python manage.py migrate
python manage.py runserverSend a test POST request to the lead webhook endpoint using synthetic data and environment-based credentials.
The repository highlights practical backend integration work: defensive input handling, configurable transformation rules, external API delivery, and traceable webhook responses.
GPL-3.0.