swiftchatquickbloxios9.3

Creating Dialog issue in private Chat with Quickblox


I am trying to implement private 1 to 1 chat with QuickBlox but following the Quickblox docs only shows for group chat in http://quickblox.com/developers/Chat#Create_dialog . When I try sending just single occupants_ids, it gives following error :

{
"errors": [
"Occupants_ids cannot be less than one."
]
}

I am hitting create Dialog API with following body :

{
"type": 3,
"name": "",
"occupant_id": "13822296"
}

Do I need to update some keys in my request body?


Solution

  • Please check: Create new 1-1(private) chat dialog

    Code from documentaton work for me:

    let chatDialog: QBChatDialog = QBChatDialog(dialogID: nil, type: QBChatDialogType.Private)
    chatDialog.occupantIDs = [user.ID]
    
    QBRequest.createDialog(chatDialog, successBlock: {(response: QBResponse?, createdDialog: QBChatDialog?) in completion?(response: response, createdDialog: chatDialog)
    
        print("sucess + \(response)")
    
    }, errorBlock: {(response: QBResponse!) in
    
        print("response + \(response)")
    })