Chat

Chats have become one of the most popular channels of communication and now you have the possibility to use it to get in touch with the visitors to your website. Users will see a small icon that displays the chat window in the bottom-right corner of your website. It’s a great way of providing your customers or potential customers with real-time assistance.

Configuration


  1. Log in to the Synerise application.
  2. Go to Settings icon Settings > Tracking Codes and create a new tracking code.
  3. Go to Settings icon Settings > Chats and add mobilechat.snrbox.com as a whitelist domain.
  4. In the same Chats section, adjust the chat settings to your preferences.

Chat Options


The SNRChat class is responsible for defining the appearance and options.

Parameter Type Default Description
navigationBarBackgroundColor UIColor UIColor.black UINavigationBar background color
navigationBarTitleColor UIColor UIColor.white UINavigationBar title color
navigationBarTitle String ‘Chat’ UINavigationBar title
closeButtonHorizontalAlignment SNRChatCloseButtonHorizontalAlignment SNRChatCloseButtonHorizontalAlignment.left
closeButtonTintColor UIColor UIColor.white Close button color
closeButtonText String ‘close’ Close button text
closeButtonImage UIImage nil Close button image
errorText String ‘An unknown backend comunnication error has occurred. Try again in a moment.’ Default error text
errorTextColor UIColor UIColor.red Error label color

Public Interface


load() - Starts loading the chat data.

show() - If the widget is loaded, the chat is shown. Otherwise it shows loading indicator.

hide() - Hides the chat window.

Delegation


SNRChatDelegate is used to inform developers about the state of a chat.

  • snr_chatIsLoading(isLoading:) - Called when the chat loading state changes. It’s an optional method.
  • snr_chatDidLoad() - Called after the chat is loaded. It’s a optional method.
  • snr_chatDidNotLoad(error:) - Called when an error occurs while loading. It’s an optional method.

Sample Implementation


class ChatLoader {
	
	static var: Chat!

	static func showChat() {
		chat = Chat(trackerKey: "YOUR_TRACKER_KEY")
		chat.navigationBarBackgroundColor = UIColor.gray
		chat.navigationBarTitle = "Chat"
		chat.navigationBarTitleColor = UIColor.white
		chat.closeButtonHorizontalAlignment = .left
		chat.closeButtonImage = UIImage(named: "icon_close_black_small")!
		chat.closeButtonTintColor = UIColor.lightGray

		chat.load()
	}

	static func hideChat() {
		chat.hide()

		chat = nil
	}
}

extension ChatLoader: ChatDelegate {
	func snr_chatIsLoading(isLoading: Bool) {
		//...
	}

	func snr_chatDidLoad() {
		chat.show()
	}

	func snr_chatDidNotLoad(error: Error) {
		//...
	}
}


😕

We are sorry to hear that

Thank you for helping improve out documentation. If you need help or have any questions, please consider contacting support.

😉

Awesome!

Thank you for helping improve out documentation. If you need help or have any questions, please consider contacting support.