no-translate

Set a pre-chat form for your chat widget

A pre-chat form will help you know more about users to give them a perfect consultation.
Napisany przez Alex
Zaktualizowano 5 miesięcy temu

If you want to ask users for their name / email / phone / company or any other custom attributes, use a welcome screen, which is available in the HelpCrunch SDK.

To enable it, you need to use HCPreChatForm.Builder. You can either choose one of four predefined attributes or create a custom one. If you set an attribute as Required, we will show a Welcome screen up until users enter their data. If you have just optional attributes, we will show a Welcome screen only once.

Java:

HCPreChatForm preChatForm = new HCPreChatForm.Builder()
        .withName(true)
        .withCompany(true)
        .withEmail(true)
        .withPhone(false)
        .withField("customAttribute", "My custom", true)
        .withField("customAttribute1", "Please enter something", true)
        .build();
HCOptions options = new HCOptions.Builder()
        .setPreChatForm(preChatForm)
        .build();

Kotlin:

val preChatForm = HCPreChatForm.build {
       withName(true)
       withCompany(true)
       withEmail(true)
       withPhone(false)
       withField("customAttribute", "My custom", true)
       withField("customAttribute1", "Please enter something", true)
       build()
}

val options = HCOptions.build {
      setPreChatForm(preChatForm)
      build()
}

Czy odpowiedzieliśmy na Twoje pytanie?