By default HelpCrunch SDK requires a user to enter his name before sending messages. You can disable this with initializing Helpcrunch with custom options:
HelpCrunchOptions opts = new HelpCrunchOptions() .setRequestName(true);
HelpCrunch.initializeWithOptions(this, YOUR_HELPCRUNCH_SUBDOMAIN, YOUR_APP_ID, YOUR_APP_SECRET, opts);
Saving app user data to HelpCrunch is done by calling HelpCrunch.updateUser(Context context,User user, Callback callback).
Important note: Be sure to put a unique User ID string in withUserID method for all your users. Constructing empty users with no data will not work (you can have no use of an empty user you cannot identify after all).
User user = new UserBuilder() .withName(username) .withUserID(userId) .withEmail(email) .withOrganization(organization) .withPhone(phone) .build(); HelpCrunch.updateUser(context, user, callback);
After you have added user’s data and called updateUser(c) it’s data will appear in your HelpCrunch admin account in chat with that user:
In addition to user’s name / email / and ID HelpCrunch lets you send custom data/attributes of your customers. With the custom data you can send any information about users you wish to track. Send Map<String,Object> containing key/value pairs of number, string or boolean data. This feature will only work if you have constructed a user with UserID:
Map<String, Object> custom = new HashMap<String, Object>(); custom.put("CUSTOM_TIME", System.currentTimeMillis()); custom.put("CUSTOM_FLAG", true); custom.put("CUSTOM_STRING", "searchText"); custom.put("CUSTOM_NUMBER", 1586); User user = new UserBuilder() .withName(username) .withUserID(userId) .withEmail(email) .withPhone(phone) .withCustomData(custom) .build(); HelpCrunch.updateUser(context, user, callback);
Custom data parameters will appear in chat with user at your HelpCrunch admin account just as same as main user attributes (name, email, user id):
Also you will be able to search or filter your users by custom data at the “Contacts” page. There are 5 types of custom data you can search by: integer, float, string, boolean, datetime (example Y-m-d H:i:s)
You can get app user data from HelpCrunch by calling:
User user = HelpCrunch.getStorage().loadUser();