Identify Events - save IDs for usage with Tento API

Identify Callbacks in Tento Embedded Scripts

This document explains how to use identify callbacks to receive User, Business, and Financing IDs from the Tento embedded script. These IDs can be later used with Tento API to query financing/bcm statuses and more.

Configuration

The Tento embedded script provides three callback functions that you can configure to receive entity IDs:

window.Tento.configure({
  onIdentifyUser: (user) => {
    // Handle user identification
    console.log('User identified:', user);
  },
  onIdentifyBusiness: (business) => {
    // Handle business identification
    console.log('Business identified:', business);
  },
  onIdentifyFinancing: (financing) => {
    // Handle financing identification
    console.log('Financing identified:', financing);
  }
});

Callback Data Formats

onIdentifyUser

Called when a user is identified in the system. The callback receives a user object with the following properties:

{
  id: string | null,      // Tento user ID
  email: string,          // User's email address
  firstName: string,      // User's first name (may be empty string)
  lastName: string        // User's last name (may be empty string)
}

onIdentifyBusiness

Called when a business is identified. The callback receives a business object with the following properties:

{
  id: string,            // Tento business ID
  name: string           // Business name
}

onIdentifyFinancing

Called when a financing is identified. The callback receives a financing object with the following properties:

{
  id: string             // Tento financing ID
}

Example Implementation

window.Tento.configure({
  partnerId: 'your-partner-id',
  customUserId: 'your-system-user-id',
  customBusinessId: 'your-system-business-id',
  onIdentifyUser: (user) => {
    console.log('Tento User ID:', user.id);
    console.log('User Email:', user.email);
    console.log('User Name:', user.firstName, user.lastName);
  },
  onIdentifyBusiness: (business) => {
    console.log('Tento Business ID:', business.id);
    console.log('Business Name:', business.name);
  },
  onIdentifyFinancing: (financing) => {
    console.log('Tento Financing ID:', financing.id);
  }
});

Best Practices

  1. Always implement error handling in your callbacks
  2. Store the mappings between Tento IDs and your system IDs
  3. Consider implementing retry logic for failed operations
  4. Log important events for debugging purposes

Usage with Widgets

The callbacks work with both BCM and Financing widgets:

// For BCM widget
window.Tento.loadBcmWidget({
  data: { /* your data */ },
  onClose: () => { /* handle close */ }
});

// For Financing widget
window.Tento.loadFinancingWidget({
  data: { /* your data */ },
  onClose: () => { /* handle close */ }
});