JS API user entity format

Different data formats, explained.
Written by Konstantine
Updated 1 month ago

This is how you can send data about your user/lead/customer to HelpCrunch during the initialization or by updateUser method.

Structure:

  • user: object
  • email: string – optional – must be a valid email, not unique
  • name: string – optional – any string, not unique
  • phone: string – optional – any string, not unique, no checks for number
  • company: string - optional - any string, not unique, no checks for number
  • user_id: string – optional – unique user ID, there are a lot of tricks here, please check the user authentication mode section to be sure you do everything right
  • security_hash: string – optional – works only with user_id – if you want to be sure, that no one steals you customer’s chat – you can pass this parameter (after you sent it once you will need to send it every time with that user_id). Please check the security note in the user authentication mode section
  • custom_data: object – optional – an object with random key/value pairs, where value can not be another object or array, be aware that all keys your pass there will appear as filters in your HelpCrunch account’s advanced search. Read more about it in the custom data section

Example:

var user: {
  email: '[email protected]',
  name: 'Ivan Dobsky',
  phone: '+43211234090',
  company: 'Apple',
  user_id: '1984',
  security_hash: 'ec02c59dee6faaca3189bace969c22d3',
  custom_data: {
    money_spent: 2500,
    subscription: 'gold',
    accepted_agreement: true,
  },
};
Did this answer your question?