NowChat API - iOS

concept australia Updated Sep 10, 2026 2 min read NowChatiOSAPI.md
Raw file servicenow.com

The NowChat API is a top-level global API that enables users to instantiate a NowChat service instance.

Parent Topic:Mobile SDK - iOS

NowChat - makeChatService(instanceUrl: URL, delegate: NowChatServiceDelegate?)

Creates an instance of NowChatService with the specified configuration.

Note: You must initialize the SDK prior to calling this function or the completion block is called with a sdkNotConfigured error. To initialize the SDK, call the NowSDK.configure() method with the desired configuration.

Name Type Description
instanceUrl URL URL of the ServiceNow instance providing chat services.
delegate NowChatServiceDelegate Optional. Delegate object that implements the NowChatServiceDelegate protocol.
Type Description
AnyPublisher<NowChatService, NowServiceError> If successful, returns an initialized NowChatService object. If it fails, returns a NowServiceError object.

The following code example shows how to call this function.

JavaScript
….guard   let jwtUrl = URL(string: "http://xx.xx.xx.xxx:8080"),  let instanceUrl = URL(string: "https://instance.service-now.com") else {    return  }// AuthorizationProvider – struct conforming to NowSDKAuthorizationProviding protocollet authorizationProvider = AuthorizationProvider(userEmail: "sdk@servicenow.com", jwtProviderUrl: jwtUrl, clientId: "deb8756b452d201039231ca568f26511")        // PermissionProvider – class conforming to DevicePermissionDelegate protocollet permissionProvider = PermissionProvider()let config = NowSDKConfiguration(authorizationProvider: authorizationProvider, permissionDelegate: permissionProvider, logLevel: .debug)	do {  try NowSDK.configure(with: config)  let chat = setup(with: instanceUrl)} catch {  // Return ConfigurationError.sdkError(error)}…..
func initializeChatService(with instanceURL: URL) -> AnyPublisher<NowService, ConfigurationError> {  NowChat.makeChatService(instanceUrl: instanceURL, delegate: nil)  .mapError { .sdkError($0) }  .map { $0 as NowService }  .eraseToAnyPublisher()}

NowChat - makeChatService(instanceUrl: URL, delegate: NowChatServiceDelegate?, completion: @escaping ((Result<NowChatService, NowServiceError>) -> Void))

Creates an instance of NowChatService with the specified configuration, and once complete, calls the specified completion handler.

Note: You must initialize the SDK prior to calling this function or the completion block is called with a sdkNotConfigured error. To initialize the SDK, call the NowSDK.configure() method with the desired configuration.

Name Type Description
instanceUrl URL URL of the ServiceNow instance providing chat services.
delegate NowChatServiceDelegate Optional. Delegate object that implements the NowChatServiceDelegate protocol.
completion @escaping ((Result<Now​Chat​Service, Now​Service​Error>) -> Void) Completion handler that is called containing either an initialized NowChatService instance or a NowServiceError indicating why the initialization failed.
Type Description
None

The following code example shows how to call this function.

JavaScript
func initializeChatService() {  NowChat.makeChatService(instanceUrl: instanceUrl, delegate: self) { [weak self] result in    guard let self = self else { return }                switch result {    case .success(let service):      self.chatService = service    case .failure(let error):      debugPrint("Creating the chat service failed with error: \(error)")    }    self.viewState = self.makeViewState()  }}
Search documentation
Search document titles and file paths on the australia branch