Closed EugeneEl closed 7 years ago
Hi @EugeneGoloboyar, try the code bellow:
QBChatDialog *chatDialog = [[QBChatDialog alloc] initWithDialogID:@"dialogID" type:QBChatDialogTypePrivate];
chatDialog.occupantIDs = @[youID, recipientID];
QBChatMessage *message = [QBChatMessage message];
if (dialog.type == QBChatDialogTypePrivate) {
message.recipientID = dialog.recipientID;
message.markable = YES;
}
message.senderID = currentUser.ID;
message.dialogID = chatDialog.ID;
message.text = @"message text";
NSMutableDictionary *params = [NSMutableDictionary dictionary];
params[@"save_to_history"] = @YES; //use this to save your message in database
[message setCustomParameters:params];
[chatDialog sendMessage:message completionBlock:^(NSError * _Nullable error) {
}];
Thanks for quick reply, works now! As I understand senderID and dialogID are obligatory parameters for message and for occupantsIDs in chatDialog.
New Issue Checklist
Environment details
I wonder can I send private message from dialog simply created with init() public init(dialogID: String?, type: QBChatDialogType)
If I already know dialogID.
I tried to do this but my message didn't appeared in database. So I cannot understand is it possible to send message simply with created manually chatDialog instance (not received in response from API). Or chatDialog properties should be fulfilled and it is insufficient to simply create chatDialog instance with id and send message with it? And I should keep an instance of chatDialog received from Quickbox server?
If it is possible to use dialogId created with id what might be an issue that message send successfully (success result) but not appeared in admin database (save to history is used)?
Thanks.