Why are pre-chat forms essential for gathering customer context before live chat routing?
Answer
Basics: Without pre-chat data, an agent opens a blank chat and spends the first minutes asking for name, email and topic. A pre-chat form asks those up front, can hide fields that the website already knows (logged-in user, order number), and writes them to the session record so routing and case creation are automatic.
How it works: Modern setup uses Messaging for In-App and Web with an Embedded Service Deployment: Setup > Embedded Service Deployments > create deployment > Pre-Chat Form. Add visible fields and hidden fields. The data maps to MessagingSession and MessagingEndUser (and can find or create Contacts). Next, an Omni-Channel flow reads those values and routes using a Route Work action to a queue, skills or an agent. The older channel, legacy Chat (formerly Live Agent), had its own pre-chat form and Chat Buttons; it is being retired in favor of Messaging, so verify dates in release notes.
Advanced / deep dive: Hidden pre-chat fields avoid asking logged-in customers for data you already have. Use them to pass the page URL, order Id or product, then use that data in the routing flow (for example set SkillRequirement for a product). Pre-chat can also trigger an Einstein Bot (now part of Agentforce/bot offerings) before handing off. Validate input, since pre-chat fields are user-controlled; never treat hidden fields as trusted for security decisions. Map fields to custom fields on MessagingSession so flows and reports can use them. For compliance, add consent text and avoid collecting sensitive data in chat transcripts.
Code / config example:
// Messaging for In-App and Web: set hidden pre-chat fields from the host page
window.addEventListener(, {
embeddedservice_bootstrap..({
: ,
: .
});
});