Recent searches


No recent searches

File Upload Fails Using Zendesk Chat SDK



Posted Nov 13, 2024

Hello Zendesk Support,

I am encountering an issue with file uploads in the Zendesk Chat SDK when using a custom ChatAPIConfiguration in my app. Here are the details and steps I have taken:

  1. Configuration Setup:
    • I initialize ChatAPIConfiguration with visitor information such as name, email, and phone number retrieved from user session data. The configuration is then assigned to Chat.instance?.configuration.
    • File uploads do not work as expected; the ChatAttachmentMessage log shows a localURL for the file but lacks an uploaded url, which I assume means the upload hasn’t completed successfully.
  2. Code Details: Below is a summary of the configuration and initialization code being used:

    var chatAPIConfig: ChatAPIConfiguration {
        let chatAPIConfig = ChatAPIConfiguration()
        guard
            let email = session.object(forKey: "user.email") as? String,
            let firstName = session.object(forKey: "user.name") as? String,
            let lastName = session.object(forKey: "user.last_name") as? String,
            let phoneNumber = session.object(forKey: "user.mobile_phone") as? String
        else {
            return chatAPIConfig
        }
        
        chatAPIConfig.visitorInfo = VisitorInfo(name: "\(firstName) \(lastName)", email: email, phoneNumber: phoneNumber)
        return chatAPIConfig
    }
    
    func initialize() {
        setChatLogging(isEnabled: true, logLevel: .verbose)
        Chat.initialize(accountKey: accountKey)
    }
    
    func openZendesk() {
        do {
            initialize()
            Chat.instance?.configuration = chatAPIConfig
            let viewController = try Messaging.instance.buildUI(engines: engines, configs: [])
            viewController.navigationItem.title = "Live Chat"
            self.navigationController?.show(viewController, sender: self)
        } catch {
            self.showSimpleAlert(title: "Error", message: "Error Zendesk")
        }
    }
    
  3. Troubleshooting Steps Taken:

    1. Confirmed that file uploads are enabled in Zendesk Chat settings.
    2. Ensured that the file size is within limits (325 KB).
    3. Enabled verbose logging with Logger.isEnabled = true and Logger.defaultLevel = .verbose, but there are no specific error messages indicating why the file does not upload.
    4. Tested on both the simulator and a real device to rule out environment-specific issues.

    Could you provide guidance on resolving this issue or suggest additional troubleshooting steps? Thank you for your assistance!


0

0

0 comments

Please sign in to leave a comment.

Didn't find what you're looking for?

New post