![](https://www.infallibletechie.com/wp-content/uploads/2023/02/Pass-Hidden-Pre-Chat-data-in-Salesforce-Messaging-for-In-App-and-Web-1024x576.jpg)
embeddedservice_bootstrap.prechatAPI.setHiddenPrechatFields() can be used to pass Hidden Pre-Chat data in Salesforce Messaging for In-App and Web.
If you are new to Messaging for In-App and Web, then use the following link for Pre-Chat Setup.
1. Create a variable in the Omni-Flow to capture the hidden Pre-Chat data.
![](https://www.infallibletechie.com/wp-content/uploads/2023/02/Salesforce-Flow-Variable.jpg)
2. Map the Flow variable to a custom field in the Omni-Flow while updating or creating the record. In my example, I created a custom field on the Case object and mapped it.
![](https://www.infallibletechie.com/wp-content/uploads/2023/02/Salesforce-Flow-Variable-Mapping.jpg)
3. Create a Custom Parameter in the Messaging Setting and map it to the Flow Variable.
![](https://www.infallibletechie.com/wp-content/uploads/2023/02/Salesforce-Flow-Variable-Mapping-to-Messaging-Custom-Parameter.jpg)
4. Use the following code before the init() method.
window.addEventListener("onEmbeddedMessagingReady", () => {
console.log( "Inside Prechat API!!" );
embeddedservice_bootstrap.prechatAPI.setHiddenPrechatFields( { "Order_Number" : "Test123" } );
});
![](https://www.infallibletechie.com/wp-content/uploads/2023/02/Salesforce-Messaging-Hiddent-PreChat-Fields.jpg)
Output:
![](https://www.infallibletechie.com/wp-content/uploads/2023/02/Salesforce-Hidden-PreChat-to-Messaging-Session.jpg)