This can be done programmatically. You can send in your signed-in user’s name and email by simply calling the setVisitorInfo method to pass those details. This will skip the pre-chat form for the users.
Mandatory properties that needs to be set are:
- name
Syntax - setVisitorInfo
HappyFoxChat.setVisitorInfo(<visitorInfoObject>, <callback>);
<visitorInfo[Object]> should have two mandatory properties name and email.
Example:
HFCHAT_CONFIG.onload = function() {
var HappyFoxChat = this;
HappyFoxChat.setVisitorInfo ({
'name': ‘Bob’,
'email': ‘bubblebob@gmail.com’
}, function(err, resp) {
if(err) {
console.error('Failed to set visitor details. Error:', err);
} else {
console.log('Added visitor details:', resp);
}
});
};
Important Note:
- This API method should be called only after the script is loaded.
- You can add your HappyFox Chat API related code with in the `onload` function.
Once a customer logs into your website and clicks on the chat widget their name will be shown directly instead of a pre-chat form.