---
sourceDocument: Australia API Reference
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/de-DE/api-reference

 Release :

    - australia

ft:locale :

    - de-DE

ft:publication_title :

    - Australia API Reference

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# Implement Virtual and Live Agent chat

# Implement Virtual and Live Agent chat {#ariaid-title1}

* Freigeben Version: Australia
* 
* Aktualisiert 12. März 2026
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 1 Minute Lesedauer

The Mobile SDK enables you to easily implement Virtual and Live Agent chat services within your iOS application.
You use the [NowChatService](https://servicenow-prod.fluidtopics.net/jPspPRx~YUj_3aZ5X1Kx7g#NowChatServiceiOSAPI "The NowChatService class provides Virtual and Live Agent chat capabilities.") API to create the chat user interface. Once the UI is created, you
must then start the chat session, and then start the chat service. Similar to other Mobile SDK feature services, the NowChatService API provides
two implementations for some of its methods, including the startChat()
method. One implementation returns a [Combine](https://developer.apple.com/documentation/combine) publisher, and the other calls a completion handler with the return
results.

The following is a snippet from the sample application that shows how to initialize and
start a chat UI and session.  

    func makeChatScreen() -> UIViewController? {
      guard let chatService = chatService else { return nil }
      let result = chatService.makeChatUI(theme: CarrascoChatTheme(chatColors: ChatColors())) 
      switch result {
        case .success(let chatViewController):
          return chatViewController
        case .failure(let error):
          debugPrint("Chat screen creation failed with error: \(error)")
          return nil 
      } 
    }

    func startChat() {
      guard let chatService = chatService else {
        debugPrint("Chat service is invalid")
        viewState = makeViewState()
        return
      } 
      chatService.startChat { [weak self] result in
        if case .failure(let error) = result {
          debugPrint("Chat session initialization failed with error: \(error)")
          self?.resetChat()
        } 
      }
    }

Before you can leverage the chat functionality within your application, you must configure Virtual Agent within your ServiceNow instance. For details, see [Virtual Agent](https://www.servicenow.com/docs/access?context=virtual-agent-landing-page&version=australia&pubname=australia-conversational-interfaces&ft:locale=en-US).

## Theme the chat user interface

You can customize the colors of the Live Agent and Virtual Agent chat UI by passing a theme object in the makeChatUI() call. For a list of all of the elements that you can customize, see [NowChatColoring protocol - iOS](https://servicenow-prod.fluidtopics.net/6xCPRbHvnM6ItzPrxJZjlQ#NowChatColoringiOSProtocol "The NowChatColoring protocol defines default colors for the elements in the Live Agent and Virtual Agent chat UI."). By default, the chat UI uses the NowUIColor theme for all NowSDK UI elements. Refer to the [NowChatThemeable protocol - iOS](https://servicenow-prod.fluidtopics.net/7iqwi1QFOx5jivkxveCXNQ "The NowChatThemeable protocol provides properties that enable you to override the colors used within chat pages hosted on your ServiceNow instance.") for sample code snippets on how to apply a theme to your chat UI.

