Author: Shashank Jha
Alignment: Realates AI Systems (Core Service #3: Auto-CRM Injection Systems)
When client acquisition funnels capture hundreds of leads across WhatsApp, web forms, and voice calls, data fragmentation becomes a major liability. Furthermore, third-party CRM APIs (like GoHighLevel or HubSpot) frequently experience network drops or rate limits. If a lead webhook fails without retry logic, that client prospect is lost.
The auto-crm-webhook-injector microservice solves data leakage through defensive integration engineering. It transforms raw inbound lead data into standardized GoHighLevel contact schemas, generates HMAC SHA256 security headers, and executes REST API injection. Crucially, it incorporates Tenacity exponential backoff retries (up to 5 attempts) to target reliable payload delivery.
sequenceDiagram
autonumber
participant AI as AI Qualification Agent
participant Inj as AutoCRMInjector Service
participant Sec as HMAC SHA256 Signer
participant CRM as GoHighLevel REST API
AI->>Inj: Dispatch Qualified Lead Object
Inj->>Inj: Transform Schema (Split Name, Map Tags)
Inj->>Sec: Sign Payload String
Sec-->>Inj: X-Realates-Signature Header
Inj->>CRM: POST /v1/contacts/ (JSON Payload)
alt Network OK (200 OK)
CRM-->>Inj: 200 Created + Contact ID
Inj-->>AI: Confirmation Status
else API Timeout / Rate Limit (503 / 429)
CRM-->>Inj: RequestException
Inj->>Inj: Tenacity Retry Backoff (Wait 2s, 4s...)
Inj->>CRM: Re-attempt POST /v1/contacts/
CRM-->>Inj: 200 Created
end
- HTTP Client: Requests
- Resiliency: Tenacity (Exponential backoff decorators)
- Security: HMAC SHA256
- Validation: Pydantic v2
3-auto-crm-webhook-injector/
├── Dockerfile # Container manifest
├── docker-compose.yml # Container orchestration
├── requirements.txt # Dependency manifest
├── .env.example # Config template
├── README.md # Operating documentation
├── ARCHITECTURE.md # Architecture specs
├── DEPLOYMENT.md # Cloud deployment instructions
├── tests/
│ └── test_injector.py # Verification test suite
└── src/
├── __init__.py
├── crm_injector.py
└── main.py
cd portfolio/3-auto-crm-webhook-injector
cp .env.example .env
pytest tests/
python -m src.main@retry(
stop=stop_after_attempt(5),
wait=wait_exponential(multiplier=1, min=2, max=10),
retry=retry_if_exception_type(requests.RequestException),
reraise=True
)
def inject_contact_into_crm(self, lead_data: Dict[str, Any]) -> Dict[str, Any]:
...