Automated loyalty program management points tracking, tier progression, reward redemption, and engagement analysis.
import requests, json, pandas as pd CRM_API = "https://api.retail.com/v2/loyalty" def fetch_customers(): resp = requests.get(CRM_API + "/customers") return resp.json().get("customers", []) def calculate_tier(points): if points >= 5000: return "Platinum" if points >= 2000: return "Gold" if points >= 500: return "Silver" return "Bronze" def suggest_reward(customer): if customer["tier"] == "Platinum": return "VIP access" if customer["tier"] == "Gold": return "RM 50 reward" if customer["tier"] == "Silver": return "20% voucher" return "Welcome bonus" def analyze_loyalty(customers): for c in customers: c["tier"] = calculate_tier(c["points"]) c["reward"] = suggest_reward(c) return customers report = analyze_loyalty(fetch_customers()) print(json.dumps(report, indent=2))
We value your privacy
We use cookies to improve your experience and analyze traffic. Privacy Policy