Track Response

Send a form submission to EnterestOS.

3 minPrerequisites: Client created

Problem: You have a client but do not know how to send form data to EnterestOS or what parameters are required.

Solution: Call trackResponse() after your form submit handler runs. Pass a type string and a payload object containing your form data.

Signature

typescript
trackResponse(input: {
  type: string;                         // Required
  payload: Record<string, any>;         // Required — your form data
  metadata?: Record<string, any>;       // Optional — page URL, source, etc.
}): Promise<Response>

Basic Example

typescript
const handleSubmit = async (formData) => {
  // 1. Your existing submit logic runs first
  await submitToYourBackend(formData);

  // 2. Track with EnterestOS after successful submit
  await enterestos.trackResponse({
    type: 'demo_request',
    payload: formData
  });
};
typescript
const handleSubmit = async (formData) => {
  await submitToYourBackend(formData);

  try {
    await enterestos.trackResponse({
      type: 'demo_request',
      payload: formData
    });
  } catch (error) {
    console.error('Tracking failed:', error);
    // Never block the form — user already succeeded
  }
};

With Metadata

typescript
await enterestos.trackResponse({
  type: 'demo_request',
  payload: {
    name: 'John Doe',
    email: '[email protected]',
    company: 'Acme Inc',
    message: 'Interested in a demo'
  },
  metadata: {
    pageUrl: window.location.pathname,
    source: 'pricing_page',
    referrer: document.referrer
  }
});

Result: Your form submissions are now tracked in EnterestOS. They appear in Inbox as Reply immediately.

Common Questions

How do I send a form submission to EnterestOS?

Call enterestos.trackResponse() after your form submit handler succeeds. Pass a type string (e.g. 'demo_request') and a payload object with your form fields. Wrap in try-catch so tracking failures never block the user.

Should I call trackResponse() before or after my existing submit logic?

Always after. Run your existing backend submit first, then call trackResponse(). If you track before the main submit and it fails, you get false submissions in your Inbox.