Integrations
Auto-Tagging Setup Guide
This guide explains how to automatically tag borrowers based on their profile data, and how to use those tags to control which loan products they can see and apply for.
What Are Auto-Tags?
Auto-tags are labels automatically assigned to borrowers based on their profile data (employer, phone number, income, loan history, etc.). They are used to:
- Control product visibility — only show a loan product to borrowers who match certain criteria
- Segment borrowers — group borrowers by employer, region, income, risk, etc.
- Automate decisions — route applications based on borrower attributes
There are two types of auto-tags:
- Built-in tags — computed automatically on every tag sync. No setup needed.
- Spec-driven tags — you create rules (called "Attribute Specs") that match borrower profile fields against patterns you define.
Part 1: Built-in Auto-Tags (No Setup Required)
These tags are computed automatically by the system on every tag sync. You can use them immediately in product visibility rules.
Employment & Income Tags
| Tag Key | Values | Source Field | How It's Computed |
|---|---|---|---|
EMPLOYER | Uppercased employer name | employer_name | The employer name is uppercased. Example: "Philadelphia Mission Africa" becomes "PHILADELPHIA MISSION AFRICA" |
EMPLOYMENT | PERMANENT, CONTRACT, PROBATION, SELF_EMPLOYED, UNEMPLOYED | employment_status | Copied directly from the employment status field |
SALARY_BAND | LOW, MID, HIGH, PREMIUM | monthly_income | LOW: under $1,000 · MID: $1,000–$2,999 · HIGH: $3,000–$4,999 · PREMIUM: $5,000+ |
TENURE_BAND | 0-1Y, 1-3Y, 3-5Y, 5Y+ | years_employed | Based on years of employment with current employer |
INDUSTRY | Uppercased industry name | industry | The industry field, uppercased. Example: "Healthcare" becomes "HEALTHCARE" |
Loan History Tags
| Tag Key | Values | How It's Computed |
|---|---|---|
LOAN_COUNT_BAND | NEW, OCCASIONAL, REGULAR, FREQUENT | NEW: 0 loans · OCCASIONAL: 1–2 · REGULAR: 3–5 · FREQUENT: 6+ |
LOAN_VALUE_BAND | LOW, MID, HIGH, PREMIUM | Total principal borrowed. LOW: under $10k · MID: $10k–$49k · HIGH: $50k–$199k · PREMIUM: $200k+ |
REPAYMENT_RATING | EXCELLENT, GOOD, FAIR, POOR | Based on on-time payment ratio across all loans |
RECURRING_BORROWER | TRUE, FALSE | TRUE if the borrower has 3 or more completed loans |
GOOD_STANDING | TRUE, FALSE | TRUE if no defaults/written-off loans and repayment ratio is 85%+ |
BLACKLISTED | TRUE, FALSE | TRUE if the borrower has any written-off or defaulted loan |
DELINQUENCY_COUNT | 0, 1, 2, 3, ... | Number of defaulted or written-off loans |
MAX_DPD | 0, 30, 60, 90, ... | Maximum days past due across all delinquent loans |
How to Use Built-in Tags in Product Rules
Go to Admin → Loan Products → [your product] → Tag Rules, and add a visibility rule:
| Rule | Meaning |
|---|---|
REQUIRE EMPLOYMENT EQ PERMANENT | Only permanent employees can see this product |
REQUIRE SALARY_BAND IN HIGH,PREMIUM | Only high-income borrowers |
EXCLUDE BLACKLISTED EQ TRUE | Hide from blacklisted borrowers |
REQUIRE GOOD_STANDING EQ TRUE | Only borrowers in good standing |
REQUIRE LOAN_COUNT_BAND EQ NEW | Only first-time borrowers |
Important: Built-in tag values are uppercase. When writing visibility rules, use uppercase values (e.g., PERMANENT, not Permanent).
Part 2: Spec-Driven Auto-Tags (Custom Rules)
Spec-driven tags let you create custom rules that match borrower profile fields against patterns you define. You create these in Admin → Tags → Auto-Tagging Specs.
How Spec-Driven Tags Work
-
You create an Attribute Spec with:
- An Attribute Key (the tag category, e.g.,
STAFF_GROUP) - A Source Field (which borrower profile field to check, e.g.,
employer_name) - A Transform Type (how to match: Pattern Match or Passthrough)
- Patterns (the rules to match against)
- A Fallback Action (what to do if no pattern matches)
- An Attribute Key (the tag category, e.g.,
-
During tag sync, the system evaluates each spec against the borrower's profile.
-
The first matching pattern wins, and its tag value is assigned.
-
If no pattern matches, the fallback action determines what happens.
Available Attribute Keys
You can use any of these whitelisted keys for spec-driven tags:
| Key | Purpose |
|---|---|
STAFF_GROUP | Staff group identification (e.g., GOVERNMENT, MNO, BANK) |
MNO_STAFF | Mobile network operator staff identification |
PHONE_PATTERN | Phone number pattern classification |
ID_PATTERN | National ID pattern classification |
MOU | MOU membership flag (TRUE/FALSE) |
VIP | VIP borrower flag |
RISK | Risk classification (LOW, MEDIUM, HIGH) |
SEGMENT | Customer segment (RETAIL, SME, CORPORATE) |
REGION | Geographic region |
BRANCH | Branch code |
CREDIT_TIER | Credit tier override |
CATEGORY | Employment category (MANAGERIAL, CLERICAL, etc.) |
PREFERRED | Preferred customer flag |
CUSTOM_TAG | Catch-all for any custom tagging need |
Available Source Fields
You can match patterns against any of these borrower profile fields:
Borrower fields: primary_phone, secondary_phone, primary_email, display_name, borrower_number, kyc_status, borrower_type
Individual fields: national_id_number, national_id_type, first_name, last_name, gender, nationality, date_of_birth, marital_status
Business fields: company_name, business_registration_number, tax_id, company_type, industry_sector, primary_contact_phone, primary_contact_email
Group fields: group_name, group_type, chairperson_phone, secretary_phone, operating_area
Employment fields: employer_name, employment_status, job_title, industry, years_employed, monthly_income
Financial fields: monthly_income, monthly_expenses, other_income
Match Modes
| Mode | Description | Example |
|---|---|---|
| Wildcard | * = any sequence, ? = single character | Ministry of* matches "Ministry of Finance" |
| Starts With | Field value must start with the pattern | 26371 matches "26371280123" |
| Ends With | Field value must end with the pattern | 222 matches "0771222584" |
| Contains | Field value must contain the pattern | 222 matches "0771222012" |
| Regex | Pattern is a regular expression | ^\d{2}-\d{7,8}[A-Z]\d{2}$ matches "12-3456789A12" |
| Equals | Exact match (case-sensitive unless ignore_case is checked) | PERMANENT matches "PERMANENT" |
Fallback Actions
| Fallback | What Happens |
|---|---|
skip | No tag assigned if no pattern matches |
default:VALUE | Assign VALUE as the tag if no pattern matches. Example: default:OTHER assigns "OTHER" |
Part 3: Step-by-Step Setup Examples
Example 1: Civil Servants (Government Employees)
Goal: Create a salary loan product only for civil servants.
Step 1: Create the Auto-Tag Spec
- Go to Admin → Tags → Auto-Tagging Specs
- Click Add Spec
- Fill in:
- Attribute Key:
STAFF_GROUP - Transform Type: Pattern Match
- Source Field:
employer_name
- Attribute Key:
- Add these patterns (check Ignore Case on each):
| Pattern | Match Mode | Tag Value | Ignore Case |
|---|---|---|---|
Ministry of* | Wildcard | GOVERNMENT | Yes |
Zimbabwe Republic Police* | Wildcard | GOVERNMENT | Yes |
Zimbabwe Defence* | Wildcard | GOVERNMENT | Yes |
Judicial Service* | Wildcard | GOVERNMENT | Yes |
Public Service Commission* | Wildcard | GOVERNMENT | Yes |
Civil Service* | Wildcard | GOVERNMENT | Yes |
ZESA* | Wildcard | GOVERNMENT | Yes |
ZINARA* | Wildcard | GOVERNMENT | Yes |
ZIMPOST* | Wildcard | GOVERNMENT | Yes |
TelOne* | Wildcard | GOVERNMENT | Yes |
National Railways* | Wildcard | GOVERNMENT | Yes |
City of* | Wildcard | LOCAL_GOVT | Yes |
Town Council* | Wildcard | LOCAL_GOVT | Yes |
Rural District* | Wildcard | LOCAL_GOVT | Yes |
- Fallback Action:
skip(non-government employees get no tag) - Click Create Spec
Step 2: Run Tag Sync
- Go to Admin → Tags → Bulk Sync
- Click Sync All Borrowers
- Wait for the sync to complete — civil servants will now have
STAFF_GROUP = GOVERNMENT
Step 3: Create the Product Visibility Rule
- Go to Admin → Loan Products → [your Salary Loan] → Tag Rules
- Add these rules:
| Rule Type | Tag Key | Operator | Value |
|---|---|---|---|
| REQUIRE | STAFF_GROUP | EQ | GOVERNMENT |
| REQUIRE | EMPLOYMENT | EQ | PERMANENT |
| EXCLUDE | BLACKLISTED | EQ | TRUE |
- Save. Now only permanent civil servants in good standing can see this product.
Step 4 (Optional): Include Local Government
If you also want municipal employees to see the product, change the first rule to:
| Rule Type | Tag Key | Operator | Value | Match Mode |
|---|---|---|---|---|
| REQUIRE | STAFF_GROUP | IN | GOVERNMENT,LOCAL_GOVT | OR |
Step 5 (Optional): Sub-Segment by Ministry
If you want separate products for different government departments, use distinct tag values instead of one GOVERNMENT bucket:
| Pattern | Tag Value |
|---|---|
Ministry of Health* | HEALTH |
Ministry of Education* | EDUCATION |
Ministry of Defence* | DEFENCE |
Zimbabwe Republic Police* | POLICE |
Then create separate products with rules like REQUIRE STAFF_GROUP EQ HEALTH for a health-worker-only loan.
Example 2: MNO Staff (Econet / NetOne Employees)
Goal: Tag borrowers who work for mobile network operators based on their phone number.
Step 1: Create the Auto-Tag Spec
- Go to Admin → Tags → Auto-Tagging Specs → Add Spec
- Fill in:
- Attribute Key:
MNO_STAFF - Transform Type: Pattern Match
- Source Field:
primary_phone
- Attribute Key:
Important: Phone numbers are normalized to international format before matching. Local 0712801234 becomes +263712801234. So your patterns should use the +263 prefix.
- Add these patterns:
| Pattern | Match Mode | Tag Value | Ignore Case |
|---|---|---|---|
+26371* | Wildcard | NETONE | No |
+26377* | Wildcard | ECONET | No |
+26378* | Wildcard | ECONET | No |
+26373* | Wildcard | TELECEL | No |
- Fallback Action:
skip - Click Create Spec
Step 2: Run Tag Sync and Add Product Rule
After syncing, add this rule to your MNO staff product:
| Rule Type | Tag Key | Operator | Value |
|---|---|---|---|
| REQUIRE | MNO_STAFF | EQ | NETONE |
Example 3: Employer-Specific Loan (MOU Partner)
Goal: Create a loan product only for employees of a specific employer with whom you have an MOU.
Step 1: Create the Auto-Tag Spec
- Go to Admin → Tags → Auto-Tagging Specs → Add Spec
- Fill in:
- Attribute Key:
MOU - Transform Type: Pattern Match
- Source Field:
employer_name
- Attribute Key:
- Add patterns for each MOU partner:
| Pattern | Match Mode | Tag Value | Ignore Case |
|---|---|---|---|
Philadelphia Mission* | Wildcard | TRUE | Yes |
ACME Corporation* | Wildcard | TRUE | Yes |
Ministry of* | Wildcard | TRUE | Yes |
- Fallback Action:
default:FALSE - Click Create Spec
Step 2: Add Product Rule
| Rule Type | Tag Key | Operator | Value |
|---|---|---|---|
| REQUIRE | MOU | EQ | TRUE |
Now only borrowers whose employer matches one of your MOU patterns can see this product.
Example 4: Region by National ID (Zimbabwe)
Goal: Tag borrowers by region based on their national ID number.
Step 1: Create the Auto-Tag Spec
- Attribute Key:
REGION - Transform Type: Pattern Match
- Source Field:
national_id_number - Add patterns (Zimbabwean national IDs contain region codes):
| Pattern | Match Mode | Tag Value |
|---|---|---|
*08* | Wildcard | HARARE |
*09* | Wildcard | BULAWAYO |
*26* | Wildcard | MASHONALAND |
*27* | Wildcard | MATABELELAND |
*28* | Wildcard | MIDLANDS |
*29* | Wildcard | MASVINGO |
*10* | Wildcard | MANICALAND |
- Fallback Action:
default:OTHER_REGION - Click Create Spec
Example 5: Borrower Type Passthrough
Goal: Restrict a nano loan product to individual borrowers only.
Step 1: Create the Auto-Tag Spec
- Attribute Key:
SEGMENT - Transform Type: Passthrough
- Source Field:
borrower_type - Fallback Action:
skip - Click Create Spec
The borrower's type (INDIVIDUAL, GROUP, COMPANY) is copied directly as the tag value.
Step 2: Add Product Rule
| Rule Type | Tag Key | Operator | Value |
|---|---|---|---|
| REQUIRE | SEGMENT | EQ | INDIVIDUAL |
Example 6: Valid National ID Check
Goal: Tag borrowers with valid Zimbabwean national ID format.
- Attribute Key:
ID_PATTERN - Transform Type: Pattern Match
- Source Field:
national_id_number - Add pattern:
| Pattern | Match Mode | Tag Value | Ignore Case |
|---|---|---|---|
^\d{2}-\d{7,8}[A-Z]\d{2}$ | Regex | VALID_ZW_NATIONAL_ID | No |
- Fallback Action:
default:INVALID_ID - Click **Create Spec`
Then add a product rule: REQUIRE ID_PATTERN EQ VALID_ZW_NATIONAL_ID
Part 4: Editing and Managing Specs
Editing a Spec
- Go to Admin → Tags → Auto-Tagging Specs
- Click the pencil icon next to the spec you want to edit
- Update the fields and click Save Changes
Editing a spec updates it in place — the version number stays the same. Use this for small corrections.
Creating a New Version
If you create a new spec with the same Attribute Key as an existing one, the system:
- Deactivates the old version (keeps it for audit history)
- Saves the new version as active
- Increments the version number
Use this when you want to replace a spec entirely while preserving the old one for audit.
Deleting a Spec
- Click the trash icon next to the spec
- Confirm the deletion
This soft-deletes the spec. Existing borrower tags are not affected — they remain until the next tag sync.
Running a Tag Sync
After creating or editing specs, run a sync to apply the new rules to existing borrowers:
- Single borrower: Go to the borrower profile → Sync Tags
- All borrowers: Go to Admin → Tags → Bulk Sync → Sync All
New borrowers are tagged automatically when their profile is created or updated.
Part 5: Common Patterns for Nano and Salary Products
Nano Product — Recommended Tag Rules
| Rule | Purpose |
|---|---|
REQUIRE SEGMENT EQ INDIVIDUAL | Only individuals, not businesses or groups |
EXCLUDE BLACKLISTED EQ TRUE | Block delinquent borrowers |
EXCLUDE GOOD_STANDING EQ FALSE | Block borrowers not in good standing |
REQUIRE SALARY_BAND IN LOW,MID | Target lower-income segments for small tickets |
Salary Product — Recommended Tag Rules
| Rule | Purpose |
|---|---|
REQUIRE EMPLOYMENT EQ PERMANENT | Only permanent employees |
REQUIRE SALARY_BAND IN HIGH,PREMIUM | Minimum income threshold |
REQUIRE TENURE_BAND IN 1-3Y,3-5Y,5Y+ | Minimum employment tenure |
REQUIRE STAFF_GROUP EQ GOVERNMENT | Restrict to civil servants (if applicable) |
EXCLUDE BLACKLISTED EQ TRUE | Block delinquent borrowers |
REQUIRE GOOD_STANDING EQ TRUE | Only borrowers in good standing |
Combining Built-in and Spec-Driven Tags
You can mix built-in and spec-driven tags in the same product. For example, a salary loan for civil servants might use:
REQUIRE STAFF_GROUP EQ GOVERNMENT (spec-driven — you created this)
REQUIRE EMPLOYMENT EQ PERMANENT (built-in — automatic)
REQUIRE SALARY_BAND IN HIGH,PREMIUM (built-in — automatic)
EXCLUDE BLACKLISTED EQ TRUE (built-in — automatic)
Part 6: Tips and Common Issues
Tip 1: Always Check "Ignore Case" for Text Fields
Borrower profile fields like employer_name are stored as typed (mixed case). Without Ignore Case checked, Ministry of* will not match "ministry of Finance". Always check Ignore Case for text fields unless you need exact case matching.
Tip 2: Use International Phone Format
Phone numbers are normalized to international format before pattern matching. Local 0712801234 becomes +263712801234. Always write phone patterns with the +263 prefix:
- Correct:
+26371*matches NetOne numbers - Incorrect:
071*will not match (the normalized number starts with+263)
Tip 3: Built-in Tag Values Are Uppercase
Built-in tags like EMPLOYER, EMPLOYMENT, SALARY_BAND, INDUSTRY are uppercased automatically. When writing visibility rules for these tags, use uppercase values:
- Correct:
REQUIRE EMPLOYMENT EQ PERMANENT - Incorrect:
REQUIRE EMPLOYMENT EQ Permanent
Spec-driven tag values use whatever casing you define in the pattern's Tag Value field.
Tip 4: First Matching Pattern Wins
If a borrower matches multiple patterns in a spec, only the first match is used. Order your patterns from most specific to least specific if there's overlap.
Tip 5: Employer Name Spelling Matters
Spec patterns match against whatever the borrower or loan officer typed in the employer_name field. If someone enters "Ministry Of Finance" vs "Ministry of Finance", Ignore Case handles capitalization, but typos like "Ministry o Finance" will not match. Train loan officers to use consistent employer names, or use broader wildcard patterns like Ministry*.
Tip 6: Test with a Real Borrower
After creating a spec, find a borrower who should match, go to their profile, and run a single-borrower tag sync. Check that the expected tag appears. If it doesn't:
- Verify the source field has a value for that borrower
- Verify the pattern matches the actual field value (check casing, spacing, format)
- Check the sync log for skip reasons
Tip 7: Use Fallback Actions Carefully
skip— the borrower gets no tag. Use this when the tag is optional (e.g., MNO_STAFF — only MNO staff should be tagged).default:VALUE— the borrower gets a default tag value. Use this when every borrower should have a value (e.g.,default:OTHERfor a REGION spec where non-matching borrowers should be tagged "OTHER").
API Reference (For Advanced Users)
All tag spec operations are available via API:
| Method | Endpoint | Purpose |
|---|---|---|
GET | /api/v1/tag-specs | List all attribute specs |
GET | /api/v1/tag-specs/:key | Get the active spec for a key |
POST | /api/v1/tag-specs | Create a new spec (deactivates old version if key exists) |
PUT | /api/v1/tag-specs/:id | Update an existing spec in place |
DELETE | /api/v1/tag-specs/:id | Soft-delete a spec |
POST | /api/v1/borrowers/:id/tags/sync | Sync tags for a single borrower |
POST | /api/v1/borrowers/tags/sync | Sync tags for all borrowers |
Example: Create a Civil Servant Spec via API
curl -X POST https://your-instance/api/v1/tag-specs \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_TOKEN" \
-d '{
"attribute_key": "STAFF_GROUP",
"source_type": "profile",
"transform_type": "pattern_match",
"transform_config": {
"field": "employer_name",
"patterns": [
{"pattern": "Ministry of*", "match_mode": "wildcard", "tag_value": "GOVERNMENT", "ignore_case": true},
{"pattern": "Zimbabwe Republic Police*", "match_mode": "wildcard", "tag_value": "GOVERNMENT", "ignore_case": true},
{"pattern": "ZESA*", "match_mode": "wildcard", "tag_value": "GOVERNMENT", "ignore_case": true}
]
},
"fallback_action": "skip"
}'
Support
For questions or issues:
- Contact the Hiana Loans support team
- Check the LOAN_PRODUCT_SETUP_GUIDE.md for general product configuration
- Check the SALARY_LOAN_PRODUCT_SETUP_GUIDE.md for salary loan workflow setup
- Check the NANO_LOAN_PRODUCT_SETUP_GUIDE.md for nano loan workflow setup
- Check the PRODUCT_TAGS_FEES_GUIDE.md for the full engineering reference of tags, fees, and late fee rules