---
sourceDocument: Xanadu API Reference
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/xanadu/api-reference

 Release :

    - xanadu

ft:locale :

    - en-US

ft:publication_title :

    - Xanadu API Reference

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# NowChatOptions - iOS

# NowChatOptions - iOS {#ariaid-title1}

* Release version: Xanadu
* 
* Updated August 1, 2024
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 2 minutes to read

The NowChatOptions class enables you to configure options, such as showing a prompt before closing a chat window or disable features while using chat, on a chat session.

## NowChatOptions - ClosePrompt(header: String?, message: String, acceptButtonTitle: String, declineButtonTitle: String) {#ariaid-title2}

Creates and returns a ClosePrompt object based on the passed parameters. You then pass this object into the NowChatOptions() method to configure the close prompt options within a chat session.
{#NChatOp-ClosePrompt_S_S_S_S__table_xb2_dcl_kbc__entry__3}

| Name | Type | Description |
|-|-|-|
| header | String | Text to display on the prompt's header. If you don't want to display a prompt header, pass "nil". |
| message | String | Text to display as the prompt's main text. |
| acceptButtonTitle | String | Text to display on the prompt's primary button for closing the chat window. |
| declineButtonTitle | String | Text to display on the prompt's secondary button that dismisses the prompt. |
[Table 1. Parameters]

{#NChatOp-ClosePrompt_S_S_S_S__table_xb2_dcl_kbc}  
The following code example shows how to call this function.

    func makeChatScreen() -> UIViewController? {
      guard let chatService = chatService else { return nil }
      let closePrompt = NowChatOptions.ClosePrompt(
        header: "Close Window",
        message: "Are you sure you want to close the chat window?",
        acceptButtonTitle: "Yes",
        declineButtonTitle: "No")

      let disabledFeatures = [.startNewConversation]
        
      let chatOptions = NowChatOptions(closePrompt: closePrompt,
        disabledFeatures: disabledFeatures,
        forceNewConversation: true)
        
      let result = chatService.makeChatUI(theme: CarrascoChatTheme(chatColors: ChatColors()), chatOptions: chatOptions)
        
      switch result {
      case .success(let chatViewController):
        return chatViewController
      case .failure(let error):
        return nil
      }
    }

## NowChatOptions - NowChatOptions(closePrompt: ClosePrompt?, disabledFeatures: \[Feature\]?, forceNewConversation: Bool) {#ariaid-title3}

Configures options for the current chat session. This method enables you to show a prompt before closing a chat window, disable features while using chat, and force a new chat conversation when the chat service
starts.
{#NChatOp-NowChatOptions_O_O_B__table_lpt_3lk_kbc__entry__3}

| Name | Type | Description |
|-|-|-|
| closePrompt | [ClosePrompt](https://servicenow-prod.fluidtopics.net/7~BC1uEmGFjruKxSPwi9pA#NChatOp-ClosePrompt_S_S_S_S "Creates and returns a ClosePrompt object based on the passed parameters. You then pass this object into the NowChatOptions() method to configure the close prompt options within a chat session.") object | Prompt to display before closing the associated chat window. If you don't want to display a close prompt, pass "nil". |
| disabledFeatures | \[Feature\] | List of chat features to disable within the current chat session. Valid value: * startNewConversation: Hide/disable the StartNew Conversation button that appears in a chat window. The available chat features are defined in the NowChatOptions.Feature enum class. If you don't want to disable any features, pass "nil". |
| forceNewConversation | Boolean | Flag that indicates whether to force a new chat conversation when the chat session starts. Any current conversations are closed. Valid values: * true: Start a new chat conversation; a new chat window opens. * false: Don't start a new chat conversation; use the existing chat window. Default: false |
[Table 2. Parameters]

{#NChatOp-NowChatOptions_O_O_B__table_lpt_3lk_kbc} {#NChatOp-NowChatOptions_O_O_B__table_mpt_3lk_kbc__entry__2}

| Type | Description |
|-|-|
| chatOptions | Returns a chatOptions object that you can pass in the [NowChatService - makeChatUI(theme: NowChatThemeable, chatOptions: NowChatOptions? = nil) -\> Result\<UIViewController, NowChatServiceError\>)](https://servicenow-prod.fluidtopics.net/V5g0WnyO4pFrtA3ShZvYew#NChatServ-makeChatUI_O "Creates a UIViewController that hosts the chat user interface.") method. |
[Table 3. Returns]

{#NChatOp-NowChatOptions_O_O_B__table_mpt_3lk_kbc}  
The following code example shows how to call this function.

    func makeChatScreen() -> UIViewController? {
      guard let chatService = chatService else { return nil }
      let closePrompt = NowChatOptions.ClosePrompt(
        header: "Close Window",
        message: "Are you sure you want to close the chat window?",
        acceptButtonTitle: "Yes",
        declineButtonTitle: "No")

      let disabledFeatures = [.startNewConversation]
        
      let chatOptions = NowChatOptions(closePrompt: closePrompt,
        disabledFeatures: disabledFeatures,
        forceNewConversation: true)
        
      let result = chatService.makeChatUI(theme: CarrascoChatTheme(chatColors: ChatColors()), chatOptions: chatOptions)
        
      switch result {
      case .success(let chatViewController):
        return chatViewController
      case .failure(let error):
        return nil
      }
    }


