Customer Data
Use DOM Package helpers for profile, order, booking, enquiry, receipt, and company data
After a customer signs in, the DOM Package can call Customer API endpoints on their behalf. These helpers add the authentication headers and handle token refresh automatically.
Created and first active
The customer returned by getUser(), authentication state callbacks, and profile create or update responses includes two read-only system timestamps in published DOM Package 1.6.3 and newer:
const session = await tiquo.getUser();
const customer = session?.customer;
if (customer) {
console.log(customer.createdAt); // number | undefined
console.log(customer.firstActiveAt); // number | undefined
const created = customer.createdAt
? new Date(customer.createdAt)
: undefined;
const firstActive = customer.firstActiveAt
? new Date(customer.firstActiveAt)
: undefined;
}| Field | Type | Definition |
|---|---|---|
createdAt | readonly number | undefined | Unix timestamp in milliseconds for when the customer profile was created |
firstActiveAt | readonly number | undefined | Unix timestamp in milliseconds for the customer's first qualifying activity; absent until activity exists |
Created and First Active are separate values. Customer activity never changes or backdates createdAt. firstActiveAt is not the database insertion time, and activities performed by staff, systems, integrations, or imports do not set it.
The values are equal when a customer creates their own account and is immediately active in the same flow. An imported or staff-created profile can have a later First Active timestamp, or no value until the customer becomes active.
Both fields use Unix milliseconds and do not include a display timezone. Convert them with new Date(timestamp) and format them using the venue or customer's timezone. They cannot be changed with updateProfile(); the SDK strips both keys if untyped JavaScript supplies them dynamically.
Updating the customer profile
await tiquo.updateProfile({
firstName: 'John',
lastName: 'Smith',
phone: '+1234567890',
});This calls the Update Profile endpoint under the hood.
Only editable profile fields should be passed to updateProfile(). createdAt and firstActiveAt are system-managed and read-only.
Profile photos can be passed as a hosted URL, a browser File or Blob, or a data:image/... or blob:... URI. File and blob uploads support JPEG, PNG, GIF, and WebP images up to 5 MB.
const file = fileInput.files?.[0];
if (file) {
await tiquo.updateProfile({
profilePhoto: file,
});
}You can also upload only the profile photo:
await tiquo.uploadProfilePhoto(file);When a file or blob is provided, the SDK requests a secure upload URL, uploads the image to Tiquo storage, then saves the resulting image URL on the authenticated customer's profile.
Editing customer preferences
Authenticated customers can edit their own customer-editable parameters with
profileParameters. The backend rejects staff-only parameters. Keys can be a
system ID, custom customer parameter schema ID, name, or normalized name.
await tiquo.updateProfile({
profileParameters: {
system_marketing_opt_in: marketingCheckbox.checked,
system_sms_opt_in: smsCheckbox.checked,
},
});Send an explicit boolean for each consent preference: true opts in and false
opts out. Omitted keys stay unchanged. The server manages the opt-in timestamp;
do not supply a date. Read the updated profile with getUser() or use the
returned customer. Consent parameter values are serialized JSON strings such as
{"Opt-In":"true"}, rather than plain booleans. The Hosted Package's profile
checkboxes decode these saved values automatically.
Text, number, date, boolean, select, multiselect, and compound parameters follow their configured validation. Multiselects accept string arrays; compound values use JSON strings. Invalid options or edit permissions reject the update. See Update Profile.
Fetching customer data
The SDK provides convenience methods for the Customer API list endpoints:
// Get order history
const orders = await tiquo.getOrders();
// Get booking history
const bookings = await tiquo.getBookings();
// Get upcoming bookings only
const upcoming = await tiquo.getUpcomingBookings();
// Get enquiry history
const enquiries = await tiquo.getEnquiries();
// Get companies the customer belongs to
const companies = await tiquo.getCompanies();getOrders(), getBookings(), and getEnquiries() accept limit, cursor, and status options and return hasMore plus an optional nextCursor. The maximum page size is 100 and the default is 50. getBookings() also accepts range: 'upcoming' | 'past'; getUpcomingBookings() is the convenience method for upcoming results sorted soonest first.
Creating enquiries
Use createEnquiry() as the submit handler for a custom form built in your application. The DOM Package does not render a generic form or expose Tiquo's form-schema builder; your application owns the fields, validation, consent text, success state, and error state.
If the visitor is already authenticated, the enquiry is linked to their customer profile. If not, Tiquo uses the public key and Website SDK website-domain configuration to accept the submission, find or create the customer by email, and attach the enquiry. Names and contact fields fill missing profile data but do not overwrite existing non-empty values. Creating an enquiry does not sign a visitor in. Customer parameters can be initialized through customer.customerParameterValues only when no stored value exists and the parameter is customer editable. Existing rows are never overwritten, even when the stored value is empty, false, or a system default. This applies to guests and authenticated enquiry submissions. customer.details remains supported as a legacy object keyed by customer parameter ID, name, or normalized key. Explicit array entries are processed first; the first non-empty value for a missing schema wins. Null, empty text, and empty arrays are ignored. Invalid or non-editable parameters reject the whole submission.
Marketing/SMS Opt-In defaults count as existing values, so this route cannot change their seeded false values. Use an authenticated profile form or the server-side Admin API to change existing preferences. Customer parameter values are saved on the profile, not included in the enquiry.created event payload.
await tiquo.createEnquiry({
customer: {
email: 'guest@example.com',
customerParameterValues: [
{ customerParameterId: 'YOUR_CUSTOMER_PARAMETER_ID', value: 'Example Ltd' },
],
// Legacy alternative: details: { YOUR_CUSTOMER_PARAMETER_ID: 'Example Ltd' }
},
enquiry: { type: 'YOUR_ENQUIRY_TYPE_ID', subject: 'Waitlist' },
});Use a customer parameter schema ID for customerParameterId, not an enquiry parameter ID. Values accept strings, finite numbers, booleans, null, or string arrays (for multiselects). At most 100 entries across both fields and 10,000 serialized characters per value are accepted. Enquiry answers remain separate under enquiry.enquiryParameterValues with enquiryParameterId.
const result = await tiquo.createEnquiry({
customer: {
email: 'customer@example.com',
firstName: 'John',
lastName: 'Smith',
phone: '+44 7911 123456',
},
enquiry: {
type: 'YOUR_ENQUIRY_TYPE_ID',
enquiryParameterValues: [
{ enquiryParameterId: 'ENQUIRY_PARAMETER_SCHEMA_ID', value: '40 guests' },
],
subject: 'Private event enquiry',
message: 'I would like to book a private event for 40 guests.',
source: 'website',
},
});
console.log(result.enquiry.id);customer.email is required. The enquiry must include either enquiry.message or enquiry.subject.
| Object | Supported fields |
|---|---|
customer | Required email; optional firstName, lastName, phone, and phoneCountry |
enquiry | Optional type, subject, message, category, priority, source, and enquiryParameterValues |
priority can be low, medium, high, or urgent. source can be online, website, phone, email, walk_in, social, referral, pos, or admin. Phone values are normalized before submission when possible.
Enquiry parameters
enquiry.enquiryParameterValues stores answers on the new enquiry only. Configure
these fields under Settings > Enquiries, when creating or editing the enquiry
type. Each entry is { enquiryParameterId, value }, where the ID belongs to that
enquiry type and organisation. These are not customer parameter IDs. Even an
enquiry field named "Marketing Opt-In" does not change customer consent.
Use strings for text, dropdown, date (YYYY-MM-DD), and datetime (ISO datetime)
values; booleans for Yes/No fields; and string arrays for multiselects. Dropdown
and multiselect options must match the configured options. Up to 100 distinct
parameters are allowed, with at most 10,000 serialized characters per value.
Empty text and empty multiselect values are omitted; false is saved.
Invalid, duplicate, deleted, wrong-type, or foreign-organisation IDs reject the
whole submission. enquiry.parameterValues and entry parameterId are not
accepted; use the explicit enquiry-prefixed names above.
The enquiry.created event includes normalized values in
enquiryParameters.<enquiryParameterId>. Values are strings, including
"true"/"false" for booleans and JSON strings for multiselects. No customer
parameter payload is included. See the Customer API enquiry reference.
Tiquo forms created in the platform are a separate feature and can be sent or embedded through their configured customer-facing flow. Use createEnquiry() when you need a completely custom website form whose result should create an enquiry. See Documents and Forms.
Receipts
Use getReceipt() to retrieve a printable receipt payload for an order owned by the authenticated customer.
const receipt = await tiquo.getReceipt('order_123');Receipts are available for orders that have been paid, refunded, or completed. Draft and pending orders do not have customer receipts yet.
Booking tickets
Bookings include a ticketing object when ticket settings are available for the booking's sublocation.
const { bookings } = await tiquo.getUpcomingBookings();
const booking = bookings[0];
if (booking?.ticketing.qrCodeTicketsEnabled) {
const ticketPdf = await tiquo.downloadBookingTicket(booking.id);
}When wallet tickets are enabled, the booking also includes wallet links:
const walletUrl = booking.ticketing.walletTicketUrl;
const appleWalletUrl = booking.ticketing.appleWalletTicketUrl;
const googleWalletUrl = booking.ticketing.googleWalletTicketUrl;Company memberships
Use getCompanies() to show the authenticated customer's company memberships.
const { companies } = await tiquo.getCompanies();
for (const company of companies) {
console.log(company.name, company.membership.relationship);
}Each company includes the customer's membership details, including whether the customer is a company admin.
Company admins can call getCompanyColleagues() to retrieve basic contact-card information for colleagues in the same company.
const company = companies.find((item) => item.membership.isCompanyAdmin);
if (company) {
const { colleagues } = await tiquo.getCompanyColleagues(company.id);
console.log(colleagues);
}If the authenticated customer is not a company admin for that company, the request returns a permissions error.