moego.business.customer.v1)Lead represents a potential customer in the sales pipeline. This interface enables:
Applicable to scenarios such as lead management, sales pipeline tracking, and marketing campaigns.
Represents a potential customer in the sales pipeline
| Field Name | Type | Description |
|---|---|---|
id |
string | Unique identifier |
companyId |
string | ID of the company the lead belongs to |
firstName |
string | Lead’s first name |
lastName |
string | Lead’s last name |
avatar |
string | URL to the lead’s profile picture |
phone |
string | Lead’s phone number. Must be in E.164 format |
email |
string | Lead’s email address. Must be valid |
address |
Address | Lead’s address |
pets |
Array(Pet) | List of pets belonging to the lead |
preferredBusinessId |
string | ID of the lead’s preferred business location |
allocateStaffId |
string | ID of the staff member assigned to the lead |
lifeCycle |
LifeCycle | Lead’s current lifecycle stage |
actionStatus |
ActionStatus | Lead’s action status |
referralSource |
ReferralSource | The source or channel through which the lead was acquired |
createdTime |
Timestamp | Creation timestamp |
lastUpdatedTime |
Timestamp | Last modification timestamp |
complianceConfig |
CustomerComplianceConfig | Lead’s compliance configuration for communication channels. See Customer ComplianceConfig for details |
customFields |
Map<string, CustomField.Value> | Custom field values. Key is the custom field code (e.g., field_123), value is the field value based on the field type. See Custom Field Documentation for details |
Note: Lead uses the same compliance configuration structure as Customer. For detailed information about compliance channels and configuration options, please refer to the Customer API Documentation.
Here is a typical integration flow:
CreateLead)CreateLead/v1/leadsCreates a new lead
| Field Name | Type | Required | Description |
|---|---|---|---|
lead |
Lead | Yes | Lead information to create |
complianceConfig |
CustomerComplianceConfigUpdateDef | No | Lead’s compliance configuration for communication channels. See Customer ComplianceConfig |
Lead Object Fields:
In addition to standard fields (firstName, lastName, phone, email, etc.), the lead object supports:
| Field Name | Type | Required | Description |
|---|---|---|---|
customFields |
Map<string, CustomField.Value> | No | Custom field values. Key is the custom field code (from ListCustomFields), value matches the field type. See Custom Field Documentation for details |
Returns the created Lead object
INVALID_ARGUMENT: Required fields are missing or invalidPERMISSION_DENIED: Permission deniedGetLead)GetLead/v1/leads/{id}Retrieves detailed information about a specific lead
| Field Name | Type | Required | Description |
|---|---|---|---|
id |
string | Yes | Lead ID to retrieve |
Returns the complete Lead object
NOT_FOUND: Specified lead ID does not existPERMISSION_DENIED: Permission deniedUpdateLead)UpdateLead/v1/leads/{id}Updates an existing lead’s information
| Field Name | Type | Required | Description |
|---|---|---|---|
id |
string | Yes | Lead ID to update |
lead |
Lead | Yes | Updated lead information |
complianceConfig |
CustomerComplianceConfigUpdateDef | No | Lead’s compliance configuration updates. See Customer ComplianceConfig |
Returns the updated Lead object
NOT_FOUND: Specified lead ID does not existINVALID_ARGUMENT: Invalid request parametersPERMISSION_DENIED: Permission deniedListLeads)ListLeads/v1/leads:listLists leads with pagination and optional filters
| Field Name | Type | Required | Description |
|---|---|---|---|
pagination |
Pagination | Yes | Pagination info: pageSize, pageToken |
companyId |
string | Yes | ID of the company to list leads for |
filter.lifeCycleId |
string | No | ID of the lead’s life cycle stage |
filter.actionStatusId |
string | No | ID of the lead’s action status |
filter.mainPhoneNumber |
string | No | Main phone number of the lead |
Note: The
paginationfield is used for pagination. ThepageSizefield specifies the number of results to return per page. Maximum value is 500. ThepageTokenfield is used to retrieve the next page of results.
Returns paginated results and lead list. Each lead in the response includes all standard fields plus any custom field values that have been set.
| Field Name | Type | Description |
|---|---|---|
nextPageToken |
string | Token for retrieving the next page of results |
leads |
Array(Lead) | List of leads with all fields including custom fields |
PERMISSION_DENIED: Permission deniedPromoteLead)PromoteLead/v1/leads:promotePromotes a lead to a customer
| Field Name | Type | Required | Description |
|---|---|---|---|
id |
string | Yes | Lead ID to promote |
Returns the newly created Customer object
NOT_FOUND: Specified lead ID does not existINVALID_ARGUMENT: Invalid request parametersPERMISSION_DENIED: Permission denied{
"lead": {
"firstName": "John",
"lastName": "Doe",
"phone": "+12125551234",
"email": "john.doe@example.com",
"address": {
"street": "123 Main St",
"city": "New York",
"state": "NY",
"zip": "10001"
},
"pets": [
{
"name": "Buddy",
"type": "DOG",
"breed": "Labrador Retriever"
}
],
"customFields": {
"field_lead_source_detail": {
"string": "Facebook Ad Campaign"
},
"field_estimated_budget": {
"money": {
"currencyCode": "USD",
"units": "500"
}
},
"field_interested_services": {
"stringList": {
"values": ["Grooming", "Boarding", "Training"]
}
},
"field_follow_up_date": {
"timestampTime": "2024-02-15T10:00:00Z"
}
}
},
"complianceConfig": {
"serviceRelatedChannels": {
"channels": ["COMPLIANCE_CHANNEL_SMS", "COMPLIANCE_CHANNEL_EMAIL"]
},
"marketingCampaignsChannels": {
"channels": ["COMPLIANCE_CHANNEL_EMAIL"]
},
"brandedAppEnabled": true,
"isAgreedMarketingPolicy": true,
"isConsented": true
}
}
{
"id": "lcus_001",
"lead": {
"firstName": "John",
"lastName": "Doe",
"phone": "+12125551234",
"email": "john.doe@example.com",
"lifeCycle": {
"id": "lc_001",
"name": "Qualified"
},
"actionStatus": {
"id": "as_001",
"name": "Contacted",
"color": "#00FF00"
}
},
"complianceConfig": {
"serviceRelatedChannels": {
"channels": ["COMPLIANCE_CHANNEL_SMS"]
},
"marketingCampaignsChannels": {
"channels": []
},
"isAgreedMarketingPolicy": false,
"isConsented": false
}
}
Request:
{
"companyId": "cmp_001",
"pagination": {
"pageSize": 20,
"pageToken": "1"
},
"filter": {
"lifeCycleId": "lc_001"
}
}
Response:
{
"nextPageToken": "2",
"leads": [
{
"id": "lcus_001",
"firstName": "John",
"lastName": "Doe",
"phone": "+12125551234",
"email": "john.doe@example.com",
"lifeCycle": {
"id": "lc_001",
"name": "Qualified"
},
"customFields": {
"field_lead_source_detail": {
"string": "Facebook Ad Campaign"
},
"field_estimated_budget": {
"money": {
"currencyCode": "USD",
"units": "500"
}
},
"field_interested_services": {
"stringList": {
"values": ["Grooming", "Boarding"]
}
}
},
"createdTime": "2024-01-15T10:00:00Z",
"lastUpdatedTime": "2024-01-20T14:30:00Z"
}
]
}
{
"id": "lcus_001"
}
TODO
| Question | Answer |
|---|---|
| How to verify if a lead exists? | Use GetLead to check if the lead ID returns a valid response |
| Can I create multiple leads at once? | Currently only single lead creation is supported |
| How to filter leads effectively? | Use ListLeads with appropriate filter parameters |
| What happens when promoting a lead? | The lead is promoted to a customer and removed from the lead system |
| How to control which communication channels can be used to contact a lead? | Use the complianceConfig field to specify allowed channels for service-related and marketing communications. Pass an empty array to clear a channel configuration. |
| How do I use custom fields with leads? | First use ListCustomFields to get available fields and their codes, then include them in the customFields map when creating or updating leads. The key is the field code (e.g., field_123) and the value type must match the field’s defined type. |
| What custom field types are supported? | Supports text, numbers, dates, booleans, selections, relations, money, time, and datetime. See Custom Field Documentation for details. |
| Error Code | Description |
|---|---|
NOT_FOUND |
Lead ID does not exist |
PERMISSION_DENIED |
Current user has no access rights |
INVALID_ARGUMENT |
Invalid request parameters |
INTERNAL |
Internal server error |