Hidden Pre-Chat for iOS
Use hidden pre-chat fields to capture valuable information without asking the customer directly for it.
This feature requires version 1.2.0 or later of the Messaging for In-App SDK.
This article applies to the following implementations:
UI SDK | Core SDK |
---|---|
✅ | ✅ |
After you set up pre-chat in Salesforce, the UI SDK automatically presents the pre-chat form to the user and passes this information to Salesforce. If you're not using the UI SDK, the Core SDK documentation describes how to perform this process programmatically. To use hidden pre-chat fields, use the Core SDK. If you want to use this feature with the UI SDK, use the Core SDK with your UI SDK.
This article describes the steps that you must take from your app to send any user data not visible in the pre-chat form. This data is also described as hidden pre-chat fields. To learn about and set up pre-chat, see Customize Pre-Chat for Messaging for In-App and Web.
After you set up hidden pre-chat fields in Salesforce, you can populate these values using the SDK.
- Implement the
HiddenPreChatDelegate
interface. This delegate contains thedidRequestPrechatValues
method, which the SDK calls when it needs pre-chat values. - Add your delegate to the SDK using the
CoreClient.preChatDelegate
property. See theCoreClient
reference documentation.
This sample code requires the configuration object that you created when setting up the UI SDK or the Core SDK. See Build a UI SDK App or Build a Core SDK App for more information.
After you register your delegate, the SDK automatically calls your didRequestPrechatValues
method before a conversation begins.