---
sourceDocument: オーストラリア API リファレンス
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/ja-JP/api-reference

 Release :

    - australia

ft:locale :

    - ja-JP

ft:publication_title :

    - オーストラリア API リファレンス

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# NowChatConfiguration : iOS

# NowChatConfiguration : iOS {#ariaid-title1}

* リリースバージョン: Australia
* 
* 更新日 2026年03月12日
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 所要時間：17分

NowChatConfiguration クラスを使用すると、チャットウィンドウを閉じる前のプロンプトの表示、チャットの使用中の機能の無効化、チャットの使用中のさまざまな会話オプションの適用、NowChat での UI コンポーネントの構成など、チャットセッションのオプションを構成できます。

## NowChatConfiguration - NowChatConfiguration(closePrompt: ClosePrompt?, disabledFeatures: \[Feature\]? = nil, conversationOptions: \[ConversationOption\]? = nil, uiConfiguration: UIConfiguration? = nil) {#ariaid-title2}

現在のチャットセッションのオプションを構成します。この方法を使用すると、チャットウィンドウを閉じる前にプロンプトを表示したり、チャットの使用中に機能を無効にしたり、チャットの使用中にさまざまな会話オプションを適用したり、NowChat の UI コンポーネントを構成したりできます。
{#NChatOp-NowChatOptions_O_O_B__table_lpt_3lk_kbc__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| プロンプトを閉じる | [プロンプトを閉じますか?](https://servicenow-prod.fluidtopics.net/aHQRRReZZPyniqPwzyBjFg#NChatOp-ClosePrompt_S_S_S_S "渡されたパラメーターに基づいて ClosePrompt オブジェクトを作成して返します。次に、このオブジェクトを NowChatConfiguration() コンストラクターに渡して、チャットセッション内のクローズプロンプトオプションを設定します。") | 関連付けられたチャットウィンドウを閉じる前に表示されるプロンプト。 [NowChatConfiguration.ClosePrompt()](https://servicenow-prod.fluidtopics.net/aHQRRReZZPyniqPwzyBjFg#NChatOp-ClosePrompt_S_S_S_S "渡されたパラメーターに基づいて ClosePrompt オブジェクトを作成して返します。次に、このオブジェクトを NowChatConfiguration() コンストラクターに渡して、チャットセッション内のクローズプロンプトオプションを設定します。") 構造体を呼び出して、このパラメーターの値を定義します。 例： closePrompt = NowChatConfiguration.ClosePrompt( header = nil, message = "Are you sure you want to leave?", acceptButtonTitle = "Yes", declineButtonTitle = "No" ) クローズプロンプトを表示しない場合は、NowChatConfiguration() 呼び出しの closePrompt 引数を省略します。 |
| 無効な機能 | \[NowChatConfiguration。機能\]? | 現在のチャットセッション内で無効にするチャット機能のリスト。 有効な値: startNewConversation:チャットウィンドウに表示される \[StartNew Conversation \] ボタンを非表示/無効にします。 使用可能なチャット機能は、 NowChatOptions.Feature 列挙型クラスで定義されます。 例： let disabledFeatures: [NowChatConfiguration.Feature]? = [.startNewConversation] 機能を無効にしない場合は、NowChatConfiguration() 呼び出しの disabledFeatures 引数を省略します。 |
| conversationOptions | \[NowChatConfiguration。ConversationOption\]? | NowChat に適用する会話オプションのリスト。 有効な値： * endConversationOnExit:NowChat ウィンドウを終了すると、進行中の会話が終了します。 * forceNewConversation:NowChat の開始時に新しいチャット会話を強制します。 {#NChatOp-NowChatOptions_O_O_B__ul_qmr_mdc_fdc} 使用可能な会話オプションは、 NowChatConfiguration.ConversationOption 列挙型クラスで定義されます。 例： let conversationOptions: [NowChatConfiguration.ConversationOption]? = [.endConversationOnExit, .forceNewConversation] 機能を無効にしない場合は、NowChatConfiguration() 呼び出しの conversationOptions 引数を省略します。 |
| UI 構成 | [UIConfiguration?](https://servicenow-prod.fluidtopics.net/aHQRRReZZPyniqPwzyBjFg#NChatCnfg-UIConfig_O_O "渡されたパラメーターに基づいて UIConfiguration オブジェクトを作成して返します。次に、このオブジェクトを NowChatConfiguration() コンストラクターに渡して、NowChat で UI コンポーネントを構成します。") | NowChat で UI コンポーネントを構成するために使用する UIConfiguration 値。 有効な値： * attachmentUploadButton:ライブエージェントとの会話中にテキスト入力の横に表示される `AttachmentUploadButton` の構成。 * closeButton:NowChat ツールバーでの戻るナビゲーションに使用される `CloseButton` の構成。 例： let attachmentUploadButton = NowChatConfiguration.AttachmentUploadButton(isVisible: false) // Default isVisible = true // Configure close button as Text let closeButtonText: NowChatConfiguration.CloseButtonType = .text("Exit") let uiConfigurationWithText = NowChatConfiguration.UIConfiguration(closeButton: closeButtonText) // Configure close button as image let buttonImage = UIImage(systemName: "arrow.left.circle") ?? nil var closeButtonImage: NowChatConfiguration.CloseButtonType? if let buttonImage { closeButtonImage = .image(buttonImage) } let uiConfigurationWithImage = NowChatConfiguration.UIConfiguration(closeButton: closeButtonImage) 提供されたシステム画像の代わりにカスタム画像を使用する場合、最適な解像度を得るには、画像の幅が 22 〜 44 ピクセル、高さが 30 ピクセルである必要があります。 AttachmentUploadButton または CloseButtonType のいずれかにデフォルトを使用するには、UIConfiguration 引数から関連するボタンを省略します。 両方のボタンにデフォルトを使用するには、NowChatConfiguration() 呼び出しの UIConfiguration パラメーターを省略します。 |
[表 : 1. パラメーター]

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

| タイプ | 説明 |
|-|-|
| NowChat 構成 | [NowChatConfiguration()](https://servicenow-prod.fluidtopics.net/aHQRRReZZPyniqPwzyBjFg#NChatOp-NowChatOptions_O_O_B "現在のチャットセッションのオプションを構成します。この方法を使用すると、チャットウィンドウを閉じる前にプロンプトを表示したり、チャットの使用中に機能を無効にしたり、チャットの使用中にさまざまな会話オプションを適用したり、NowChat の UI コンポーネントを構成したりできます。") メソッドを呼び出すときに渡すことができる NowChatConfiguration オブジェクトを返します。 |
[表 : 2. 返される内容]

{#NChatOp-NowChatOptions_O_O_B__table_mpt_3lk_kbc}  
次のコード例は、このメソッドを呼び出してチャット UI を構成する方法を示しています。

    func makeChatScreen() -> UIViewController? {
      let closePrompt = NowChatConfiguration.ClosePrompt(
        header: nil,
        message: "Are you sure you want to leave?",
        acceptButtonTitle: "Yes",
        declineButtonTitle: "No"
      )

      let disabledFeatures: [NowChatConfiguration.Feature]? = [.startNewConversation]

      let conversationOptions: [NowChatConfiguration.ConversationOption]? = [.endConversationOnExit, .forceNewConversation] 

      let attachmentUploadButton = NowChatConfiguration.AttachmentUploadButton(isVisible: false) 

      // Configure close button as Text
      let closeButtonText: NowChatConfiguration.CloseButtonType = .text("Exit")
      let uiConfigurationWithText = NowChatConfiguration.UIConfiguration(closeButton: closeButtonText, attachmentUploadButton: attachmentUploadButton) 
     
      // Configure close button as image 
      let buttonImage = UIImage(systemName: "arrow.left.circle") ?? nil 

      var closeButtonImage: NowChatConfiguration.CloseButtonType?
      if let buttonImage {
        closeButtonImage = .image(buttonImage)
      }
      let uiConfigurationWithImage = NowChatConfiguration.UIConfiguration(closeButton: closeButtonImage, attachmentUploadButton: attachmentUploadButton)    

      let chatConfiguration = NowChatConfiguration(closePrompt: closePrompt, 
        disabledFeatures: disabledFeatures,
        conversationOptions: conversationOptions,
        uiConfiguration: uiConfigurationWithImage)

      let result = chatService.makeChatUI(theme: CarrascoChatTheme(chatColors: ChatColors()), chatConfiguration: chatConfiguration)  

      switch result { 
        case .success(let chatViewController):
          return chatViewController
        case .failure(let error):
          debugPrint("Chat screen creation failed with error: \(error)")
          return nil
      }
    }

## NowChatConfiguration - AttachmentUploadButton(isVisible: ブール = true) {#ariaid-title3}

ライブエージェントとの会話中にテキスト入力の横に表示される \[添付ファイルをアップロード\] ボタンに適用する UI 構成を定義します。
AttachmentUploadButton は NowChatConfiguration クラスの構造体です。
{#NChatCnfg-AttachUploadButton_B__table_tym_brc_fdc__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| isVisible | ブーリアン | \[添付ファイルをアップロード\] ボタンのヴィジビリティを示すフラグ。 有効な値： * true:\[添付ファイルをアップロード\] ボタンが表示されます。 * false:\[添付ファイルをアップロード\] ボタンは非表示です。 デフォルト：true |
[表 : 3. パラメーター]

{#NChatCnfg-AttachUploadButton_B__table_tym_brc_fdc} {#NChatCnfg-AttachUploadButton_B__table_uym_brc_fdc__entry__2}

| タイプ | 説明 |
|-|-|
| なし |   |
[表 : 4. 返される内容]

{#NChatCnfg-AttachUploadButton_B__table_uym_brc_fdc}  
次のコード例は、AttachmentUploadButton を非表示にする方法を示しています。

    func makeChatScreen() -> UIViewController? {
      let attachmentUploadButton = NowChatConfiguration.AttachmentUploadButton(isVisible: false)
      let uiConfigurationWithAttachmentButton = NowChatConfiguration.UIConfiguration(attachmentUploadButton: attachmentUploadButton)         

      let chatConfiguration = NowChatConfiguration(uiConfiguration: uiConfigurationWithAttachmentButton) 

      let result = chatService.makeChatUI(theme: CarrascoChatTheme(chatColors: ChatColors()), chatConfiguration: chatConfiguration) 

      switch result {
        case .success(let chatViewController):
          return chatViewController
        case .failure(let error):
          debugPrint("Chat screen creation failed with error: \(error)")
          return nil
      }
    }

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

渡されたパラメーターに基づいて ClosePrompt オブジェクトを作成して返します。次に、このオブジェクトを NowChatConfiguration() コンストラクターに渡して、チャットセッション内のクローズプロンプトオプションを設定します。
{#NChatOp-ClosePrompt_S_S_S_S__table_xb2_dcl_kbc__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| ヘッダー | 文字列 | プロンプトのヘッダーに表示するテキスト。 プロンプトヘッダーを表示しない場合は、「nil」を渡します。 |
| メッセージ | 文字列 | プロンプトのメインテキストとして表示するテキスト。 |
| acceptButtonTitle | 文字列 | チャットウィンドウを閉じるためにプロンプトのプライマリボタンに表示するテキスト。 |
| 拒否ボタンのタイトル | 文字列 | プロンプトを却下するプロンプトのセカンダリボタンに表示するテキスト。 |
[表 : 5. パラメーター]

{#NChatOp-ClosePrompt_S_S_S_S__table_xb2_dcl_kbc}  
次のコード例は、この関数を呼び出す方法を示しています。

    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
      }
    }

## NowChatConfiguration - UIConfiguration(closeButton: CloseButtonType? = nil, attachmentUploadButton: AttachmentUploadButton? = nil) {#ariaid-title5}

渡されたパラメーターに基づいて UIConfiguration オブジェクトを作成して返します。次に、このオブジェクトを NowChatConfiguration() コンストラクターに渡して、NowChat で UI コンポーネントを構成します。
UIConfiguration() は NowChatConfiguration クラスの構造体です。
{#NChatCnfg-UIConfig_O_O__table_fwq_z3j_fdc__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| 閉じるボタン | CloseButtonType? | NowChat ツールバーに表示され、戻るナビゲーションに使用される `CloseButtonType` の構成。 有効な値： * image (UIImage):画像付きの \[閉じる\] ボタンを作成します。 * text (文字列):閉じるボタンをテキストとして作成します。これを使用して、戻るボタンのカスタム名を渡します。 使用可能な `CloseButtonType` オプションは、 NowChatConfiguration.CloseButtonType 列挙型クラスで定義されます。 例： func makeChatScreen() -> UIViewController? { // Configure close button as Text let closeButtonText: NowChatConfiguration.CloseButtonType = .text("Exit") let uiConfigurationWithText = NowChatConfiguration.UIConfiguration(closeButton: closeButtonText) // Configure close button as image let buttonImage = UIImage(systemName: "arrow.left.circle") ?? nil var closeButtonImage: NowChatConfiguration.CloseButtonType? if let buttonImage { closeButtonImage = .image(buttonImage) } let uiConfigurationWithImage = NowChatConfiguration.UIConfiguration(closeButton: closeButtonImage) let chatConfiguration = NowChatConfiguration(uiConfiguration: uiConfigurationWithImage) // or // let chatConfiguration = NowChatConfiguration(uiConfiguration: uiConfigurationWithText) |
| 添付ファイルアップロードボタン | [AttachmentUploadButton?](https://servicenow-prod.fluidtopics.net/aHQRRReZZPyniqPwzyBjFg#NChatCnfg-AttachUploadButton_B "ライブエージェントとの会話中にテキスト入力の横に表示される [添付ファイルをアップロード] ボタンに適用する UI 構成を定義します。") | ライブエージェントとの会話中にテキスト入力の横に表示される `AttachmentUploadButton` の構成。 [NowChatConfiguration - AttachmentUploadButton(isVisible: ブール = true)](https://servicenow-prod.fluidtopics.net/aHQRRReZZPyniqPwzyBjFg#NChatCnfg-AttachUploadButton_B "ライブエージェントとの会話中にテキスト入力の横に表示される [添付ファイルをアップロード] ボタンに適用する UI 構成を定義します。") メソッドを呼び出して、このパラメーターの値を定義します。 例： let attachmentUploadButton = NowChatConfiguration.AttachmentUploadButton(isVisible: false) let uiConfigurationWithAttachmentButton = NowChatConfiguration.UIConfiguration(attachmentUploadButton: attachmentUploadButton) let chatConfiguration = NowChatConfiguration(uiConfiguration: uiConfigurationWithAttachmentButton) |
[表 : 6. パラメーター]

{#NChatCnfg-UIConfig_O_O__table_fwq_z3j_fdc} {#NChatCnfg-UIConfig_O_O__table_gwq_z3j_fdc__entry__2}

| タイプ | 説明 |
|-|-|
| オブジェクト | UI 構成オブジェクト |
[表 : 7. 返される内容]

{#NChatCnfg-UIConfig_O_O__table_gwq_z3j_fdc}  
次のコード例は、 UIConfiguration() サブクラスを呼び出してチャット UI 構成を設定する方法を示しています。

    func makeChatScreen() -> UIViewController? {

      let attachmentUploadButton = NowChatConfiguration.AttachmentUploadButton(isVisible: false)

      // Configure close button as image
      let buttonImage = UIImage(systemName: "arrow.left.circle") ?? nil

      var closeButtonImage: NowChatConfiguration.CloseButtonType?
      if let buttonImage {
        closeButtonImage = .image(buttonImage)
      }
      let uiConfigurationWithImage = NowChatConfiguration.UIConfiguration(closeButton: closeButtonImage, attachmentUploadButton: attachmentUploadButton)         

      let chatConfiguration = NowChatConfiguration(uiConfiguration: uiConfigurationWithImage) 

      let result = chatService.makeChatUI(theme: CarrascoChatTheme(chatColors: ChatColors()), chatConfiguration: chatConfiguration)

      switch result { 
        case .success(let chatViewController):
          return chatViewController
        case .failure(let error):
          debugPrint("Chat screen creation failed with error: \(error)")
          return nil
      }
    }


