diff --git a/Sources/KoreBotSDK/AppKit/Common/BotConnect.swift b/Sources/KoreBotSDK/AppKit/Common/BotConnect.swift index 1a5c0a6e..ff8ed0b7 100644 --- a/Sources/KoreBotSDK/AppKit/Common/BotConnect.swift +++ b/Sources/KoreBotSDK/AppKit/Common/BotConnect.swift @@ -18,6 +18,7 @@ open class BotConnect: NSObject { public var closeAgentChatEventName = "close_agent_chat" public var closeButtonEventName = "close_button_event" public var minimizeButtonEventName = "minimize_button_event" + public var isZenDeskEvent = false public var closeOrMinimizeEvent: ((_ dic: [String:Any]?) -> Void)! // MARK: - init @@ -35,6 +36,7 @@ open class BotConnect: NSObject { close_AgentChat_EventName = closeAgentChatEventName close_Button_EventName = closeButtonEventName minimize_Button_EventName = minimizeButtonEventName + isZenDesk_Event = isZenDeskEvent guard let rootViewController = UIApplication.shared.keyWindow?.rootViewController else { return } diff --git a/Sources/KoreBotSDK/AppKit/Common/Common.swift b/Sources/KoreBotSDK/AppKit/Common/Common.swift index d45f29fa..0589b6a5 100755 --- a/Sources/KoreBotSDK/AppKit/Common/Common.swift +++ b/Sources/KoreBotSDK/AppKit/Common/Common.swift @@ -70,6 +70,7 @@ var arrayOfSelectedBtnIndex:NSMutableArray = NSMutableArray() var close_AgentChat_EventName = "close_agent_chat" var close_Button_EventName = "close_button_event" var minimize_Button_EventName = "minimize_button_event" +var isZenDesk_Event = false open class Common : NSObject { public static func UIColorRGB(_ rgb: Int) -> UIColor { diff --git a/Sources/KoreBotSDK/RTM/Library/RTM/RTMPersistentConnection.swift b/Sources/KoreBotSDK/RTM/Library/RTM/RTMPersistentConnection.swift index 0169b3b8..44ca68c9 100755 --- a/Sources/KoreBotSDK/RTM/Library/RTM/RTMPersistentConnection.swift +++ b/Sources/KoreBotSDK/RTM/Library/RTM/RTMPersistentConnection.swift @@ -368,13 +368,22 @@ open class RTMPersistentConnection : NSObject, WebSocketDelegate { print("Socket is in OPEN state") let dictionary: NSMutableDictionary = NSMutableDictionary() let messageObject: NSMutableDictionary = NSMutableDictionary() - messageObject.addEntries(from: ["body": message, "attachments":[], "customData": parameters] as [String : Any]) + if isZenDesk_Event{ + messageObject.addEntries(from: ["body": eventName, "attachments":[], "customData": parameters] as [String : Any]) + }else{ + messageObject.addEntries(from: ["body": message, "attachments":[], "customData": parameters] as [String : Any]) + } + if let object = options { messageObject.addEntries(from: object) } dictionary.setObject(messageObject, forKey: "message" as NSCopying) - dictionary.setObject("/bot.message", forKey: "resourceid" as NSCopying) + if isZenDesk_Event{ + dictionary.setObject("/bot.clientEvent", forKey: "resourceid" as NSCopying) + }else{ + dictionary.setObject("/bot.message", forKey: "resourceid" as NSCopying) + } if (self.botInfoParameters != nil) { dictionary.setObject(self.botInfoParameters as Any, forKey: "botInfo" as NSCopying) }