Skip to main content

Quickstart

A complete flow: create a category, add and verify an address, publish a property listing against it, and capture an inquiry. The Python examples use the property resources instantiated from the client.

import {
WiilClient,
PropertyType,
PropertySubType,
ListingType,
ListingStatus,
PropertyInquiryType,
PreferredContactMethod,
} from 'wiil-js';

async function listProperty() {
const client = new WiilClient({ apiKey: process.env.WIIL_API_KEY! });

// 1. Create a category
const category = await client.propertyConfig.createCategory({
name: 'Luxury Homes',
description: 'Premium properties over $1M',
propertyType: PropertyType.RESIDENTIAL,
displayOrder: 1,
isDefault: false,
});

// 2. Create an address, then verify it
const address = await client.propertyConfig.createAddress({
street: '100 Ocean Drive',
city: 'Palm Beach',
state: 'FL',
postalCode: '33480',
country: 'USA',
coordinates: { latitude: 26.7056, longitude: -80.0364 },
isVerified: false,
});
await client.propertyConfig.verifyAddress(address.id);

// 3. Publish the listing
const property = await client.propertyConfig.create({
categoryId: category.id,
addressId: address.id,
title: 'Oceanfront Estate with Private Beach',
description: 'Magnificent estate with 200 feet of ocean frontage',
propertyType: PropertyType.RESIDENTIAL,
propertySubType: PropertySubType.VILLA,
listingType: ListingType.SALE,
listingStatus: ListingStatus.ACTIVE,
salePrice: 12500000,
salePriceCurrency: 'USD',
features: { bedrooms: 8, bathrooms: 10, squareFootage: 15000, amenities: ['Private beach', 'Infinity pool'] },
images: ['https://example.com/estate.jpg'],
isActive: true,
isFeatured: true,
});

// 4. Capture an inquiry
const inquiry = await client.propertyInquiries.create({
propertyId: property.id,
customer: {
firstName: 'Jane',
lastName: 'Doe',
email: 'jane@example.com',
phone: '+15550000001',
preferredContactMethod: PreferredContactMethod.PHONE,
},
inquiryType: PropertyInquiryType.GENERAL,
message: 'Interested in a private showing.',
source: 'website',
interestedInBuying: true,
budgetMax: 13000000,
});

return { category, address, property, inquiry };
}

listProperty().catch(console.error);

Next steps