Package zendesk.chat
Class ChatConfiguration.Builder
- java.lang.Object
-
- zendesk.chat.ChatConfiguration.Builder
-
- Enclosing class:
- ChatConfiguration
public static class ChatConfiguration.Builder extends java.lang.Object
Fluent API to construct instances ofChatConfiguration
.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description ChatConfiguration
build()
Constructs a new instance ofChatConfiguration
.ChatConfiguration.Builder
withAgentAvailabilityEnabled(boolean agentAvailabilityEnabled)
Toggles the agent availability on or off.ChatConfiguration.Builder
withChatMenuActions(ChatMenuAction... chatMenuActions)
Allows overriding of the conversation menu.ChatConfiguration.Builder
withDepartmentFieldStatus(PreChatFormFieldStatus status)
Sets the status of the 'department' field in the pre-Chat form.ChatConfiguration.Builder
withEmailFieldStatus(PreChatFormFieldStatus status)
Sets the status of the 'email' field in the pre-Chat form.ChatConfiguration.Builder
withNameFieldStatus(PreChatFormFieldStatus status)
Sets the status of the 'name' field in the pre-Chat form.ChatConfiguration.Builder
withOfflineFormEnabled(boolean offlineFormEnabled)
Toggles the offline form on or off.ChatConfiguration.Builder
withPhoneFieldStatus(PreChatFormFieldStatus status)
Sets the status of the 'phone number' field in the pre-Chat form.ChatConfiguration.Builder
withPreChatFormEnabled(boolean preChatFormEnabled)
Toggles the entire pre-Chat form on or off.ChatConfiguration.Builder
withTranscriptEnabled(boolean transcriptEnabled)
Toggles the flag to either enable or disable the email transcript prompt at the end of a chat that allows end users to request a transcript.
-
-
-
Method Detail
-
withAgentAvailabilityEnabled
public ChatConfiguration.Builder withAgentAvailabilityEnabled(boolean agentAvailabilityEnabled)
Toggles the agent availability on or off. Defaults to on.Agent availability is a feature that prevents the visitor from sending messages when there are no agents online. Enabling this feature will prevent your business from getting missed chats.
- Parameters:
agentAvailabilityEnabled
-true
to enable,false
to disable- Returns:
- This builder with updated agent availability flag
-
withTranscriptEnabled
public ChatConfiguration.Builder withTranscriptEnabled(boolean transcriptEnabled)
Toggles the flag to either enable or disable the email transcript prompt at the end of a chat that allows end users to request a transcript.- Parameters:
transcriptEnabled
-true
to enable,false
to disable- Returns:
- This builder with updated agent availability flag
-
withOfflineFormEnabled
public ChatConfiguration.Builder withOfflineFormEnabled(boolean offlineFormEnabled)
Toggles the offline form on or off. Defaults to on.Offline form is an alternative feature to live chat that can be used to contact the business when all agents are unavailable while avoiding missed chats.
Similarly to pre-Chat, the offline form also collects information about the visitor in a conversational manner prior to sending the form.
- Parameters:
offlineFormEnabled
-true
to enable the offline form,false
to disable.- Returns:
- This builder with updated offline form feature flag.
-
withPreChatFormEnabled
public ChatConfiguration.Builder withPreChatFormEnabled(boolean preChatFormEnabled)
Toggles the entire pre-Chat form on or off. Defaults to on.Pre-Chat form is a feature that collects information about the visitor in a conversational manner prior to starting the chat.
You can customise what information to collect by further configuring this builder with the following methods:
ChatConfiguration.Builder.withNameFieldStatus(PreChatFormFieldStatus)
to configure whether to collect the nameChatConfiguration.Builder.withEmailFieldStatus(PreChatFormFieldStatus)
to configure whether to collect the emailChatConfiguration.Builder.withPhoneFieldStatus(PreChatFormFieldStatus)
to configure whether to collect the phoneChatConfiguration.Builder.withDepartmentFieldStatus(PreChatFormFieldStatus)
to configure whether to ask for department- Parameters:
preChatFormEnabled
-true
to enable the pre-Chat form,false
to disable.- Returns:
- This builder with updated pre-Chat feature flag.
-
withChatMenuActions
public ChatConfiguration.Builder withChatMenuActions(ChatMenuAction... chatMenuActions)
Allows overriding of the conversation menu. By default the menu contains allChatMenuAction
items.- To disable the menu call this method with no argument:
withChatMenuActions()
- To disable the end chat menu item:
withChatMenuActions(ChatMenuAction.CHAT_TRANSCRIPT)
- To disable the chat transcript menu item:
withChatMenuActions(ChatMenuAction.END_CHAT)
- Parameters:
chatMenuActions
- variableChatMenuAction
items.- Returns:
- This builder with updated chat menu items.
- To disable the menu call this method with no argument:
-
withNameFieldStatus
public ChatConfiguration.Builder withNameFieldStatus(PreChatFormFieldStatus status)
Sets the status of the 'name' field in the pre-Chat form. Defaults toPreChatFormFieldStatus.OPTIONAL
. An optional field can be skipped by the user. A required field cannot be skipped by the user, and the form will not proceed until they have provided a valid value. A hidden field is not shown to the user.- Parameters:
status
- thePreChatFormFieldStatus
to use for the 'name' field in the pre-Chat form.- Returns:
- This builder with updated 'name' field status.
-
withEmailFieldStatus
public ChatConfiguration.Builder withEmailFieldStatus(PreChatFormFieldStatus status)
Sets the status of the 'email' field in the pre-Chat form. Defaults toPreChatFormFieldStatus.OPTIONAL
. An optional field can be skipped by the user. A required field cannot be skipped by the user, and the form will not proceed until they have provided a valid value. A hidden field is not shown to the user.- Parameters:
status
- thePreChatFormFieldStatus
to use for the 'email' field in the pre-Chat form.- Returns:
- This builder with updated 'email' field requirement status.
-
withPhoneFieldStatus
public ChatConfiguration.Builder withPhoneFieldStatus(PreChatFormFieldStatus status)
Sets the status of the 'phone number' field in the pre-Chat form. Defaults toPreChatFormFieldStatus.OPTIONAL
. An optional field can be skipped by the user. A required field cannot be skipped by the user, and the form will not proceed until they have provided a valid value. A hidden field is not shown to the user.- Parameters:
status
- thePreChatFormFieldStatus
to use for the 'phone number' field in the pre-Chat form.- Returns:
- This builder with updated 'phone number' field requirement status.
-
withDepartmentFieldStatus
public ChatConfiguration.Builder withDepartmentFieldStatus(PreChatFormFieldStatus status)
Sets the status of the 'department' field in the pre-Chat form. Defaults toPreChatFormFieldStatus.OPTIONAL
. An optional field can be skipped by the user. A required field cannot be skipped by the user, and the form will not proceed until they have provided a valid value. A hidden field is not shown to the user. If a department has already been set usingChatProvider#setDepartment(String, ZendeskCallback)
, the field will never be shown, regardless of the value passed to this method.- Parameters:
status
- thePreChatFormFieldStatus
to use for the 'department' field in the pre-Chat form.- Returns:
- This builder with updated 'department' field required status.
-
build
public ChatConfiguration build()
Constructs a new instance ofChatConfiguration
. All fields which haven't been set default totrue
- Returns:
- A new instance of
ChatConfiguration
-
-