Chat Assist SDK helps you to seamlessly integrate a chat window into your application, providing real-time messaging capabilities and enhancing user interaction.
Instructions on how to install the project.
List any prerequisites that need to be installed first.
- Xcode 15 or later
- CocoaPods (If CocoaPods is the package manager)
- In Xcode, open
File > Add Packages. - Search https://github.com/Readyly/chatassist-sdk-ios.git
- ChatAssist should be listed. Click
Add Package
You can use CocoaPods to install ChatAssist
- To install Cocoapods to Mac, on the Terminal, run
sudo gem install cocoapods - Adding ChatAssist to your Podfile:
use_frameworks!
target 'MyApp' do
pod 'ChatAssist'
end
- Run
pod installon the terminal where Podfile is located.
- Add ChatAssist to the file where you want to use by
import ChatAssist- Initialize the ChatAssist by providing the context parameters.
orgName: Organisation nameprofile: Chat Profile *optional
let context = Chat.Context(orgName: "help", profile: "christmas")
var chat = try Chat(context: context)- Start chat session
chat?.startSession()- End chat session
chat?.endSession()- Observing States and Messages from the Chat Server, add
ChatAssistDelegate
extension ChatViewModel: ChatAssistDelegate {
public func chatDidReceiveErrorAction(message: String) {
print("Error occured: \(message)")
}
public func chatDidReceiveReadyAction() {
}
public func chatDidReceiveCloseAction() {
}
public func chatDidReceiveExpandAction() {
}
public func chatDidReceiveMinimiseAction() {
}
}- Sending user details
The payload type is dictionary. If user details are not sent, the widget will prompt the user when required.
chat?.postMessage(type: .userDetails, payload: ["firstName":"Mauro",
"lastName":"Icardi",
"email":"[email protected]"])- Sending additional details
The payload type is dictionary.
details within the payload will be attached to the ticket created during the session.
If the append option is false any prior additional details will be overwritten.
chat?.postMessage(type: .additionalDetails, payload: ["details":"diagnostics or relevant details",
"options": ["append":false]])