Here we are going to learn how can we route chat to different Chat buttons based on input given on Pre-Chat form when we implement the same with the help of Snap-In (Embedded Service Deployment)
It helps to route customers to specific Agents based on their selection on Pre-Chat form.
To achieve this we simply need to follow the following snippet.
embedded_svc.settings.directToButtonRouting = function(prechatFormData) { // Dynamically changes the button ID based on what the visitor enters in the pre-chat form. // Returns a valid button ID. if(prechatFormData[2].value==' Service') return '573xxxxxxxxxxxx'; else if(prechatFormData[2].value==' Sales')
return '573xxxxxxxxxxxx';
};
here "prechatFormData" helps to get the values given in Pre-chat form. We have to get the values based on index of each pre chat form field. Index starts with '0' in sequence from Left to Right always.
In the above example at the index of "2" user is selecting department type as "Sales" or "Service" based on the selected value we are able to route as as shown above.
Note: We have to write the above snippet before "embedded_svc.init"
Reference:
https://developer.salesforce.com/docs/atlas.en-us.snapins_web_dev.meta/snapins_web_dev/snapins_web_snippet_settings_file.htm
No comments:
Post a Comment