Skip to content

Enquiries (moments)

An enquiry is stored as a moment: a customer reaching out to a dealer, usually about a vehicle. Moments come from website forms, chat, phone calls and partner leads.

query Enquiry($id: uuid!) {
moments_by_pk(id: $id) {
id
friendly_id
type
stage
channel
priority
enquiry_reason
created_at
customer_full_name
customer_email
customer_phone
is_guest
utm_data
stocked_vehicle {
id
code
make
model
stock_id
}
location {
name
}
owner {
full_name
email
}
form_submission {
values
}
}
}

Today’s enquiries for one showroom, newest first:

query Enquiries($showroomId: uuid!, $since: timestamptz!) {
moments(
where: { showroom_id: { _eq: $showroomId }, created_at: { _gte: $since } }
order_by: [{ created_at: desc }, { id: asc }]
limit: 50
) {
id
friendly_id
type
stage
channel
created_at
customer_full_name
customer_email
stocked_vehicle {
make
model
}
}
}
To find Add to where
Not yet handled _or: [{ stage: { _eq: "pending" } }, { stage: { _is_null: true } }]
About a vehicle stocked_vehicle_id: { _eq: "…" }
Unassigned owner_id: { _is_null: true }
From your campaigns utm_data: { _contains: { utm_source: "yourbrand" } }
From guests is_guest: { _eq: true }

Count them by stage:

query EnquiryCounts($showroomId: uuid!) {
pending: moments_aggregate(where: { showroom_id: { _eq: $showroomId }, stage: { _eq: "pending" } }) {
aggregate {
count
}
}
all: moments_aggregate(where: { showroom_id: { _eq: $showroomId } }) {
aggregate {
count
}
}
}
Field Notes
friendly_id Short reference to show staff and customers.
type What kind of moment: enquiry for a general enquiry, stocked for one about a stocked vehicle.
stage Where it is in the dealer’s process. Starts as pending (or empty), then for example assigned, 1st_contact, engaged. Dealers can use their own stages, so don’t hard-code the list.
channel Where it came from: online, phone, walk-in, or a partner such as carsales-enquiry. Free text.
user_id / guest_user_id The customer. is_guest says which is set.
customer_* The customer’s name, email and phone, copied at the time of the enquiry.
utm_data JSON of the UTM parameters on the visit.
form_submission The form answers, when the enquiry came from a form.