Titanium JIRA Archive
Appcelerator Community (AC)

[AC-5716] Cloud.Chats.create with custom_field

GitHub Issuen/a
TypeBug
Priorityn/a
StatusResolved
ResolutionCannot Reproduce
Resolution Date2018-05-20T06:41:09.000+0000
Affected Version/sn/a
Fix Version/sn/a
Componentsn/a
Labelsn/a
ReporterEmmanuel Francis
AssigneeShak Hossain
Created2018-04-27T17:42:00.000+0000
Updated2018-05-20T06:41:10.000+0000

Description

I am trying to create a chat with custom fields as follows
                 {
			    message: message,
			    custom_field:{
			    	"[CUSTOM_chatrooms]chatroom_id":3343
			    }
		};
It creates the chat, but when I query to get chat group as follows it does not return
Cloud.Chats.getChatGroups({
	where: {
        	"[CUSTOM_chatrooms] chatroom_id": 3343
    	}	
},...
Does ACS allow this?

Comments

  1. Sharif AbuDarda 2018-04-28

    Hello, I believe you have to define chatgroup when creating chats. https://docs.appcelerator.com/arrowdb/latest/#!/api/Chats-method-create Please follow here. Thanks.
  2. Emmanuel Francis 2018-04-28

    chat_group_id won't be available until a chat record is created. chat_group_id is optional. My objective is to create a chat group for the "chat room". So created first chat and passed the room_id, so that later I will pass chat_group_id for future chat message in that "chat room".
  3. Mostafizur Rahman 2018-04-29

    Hello, *chat_group_id* Identifies an existing chat group by ID.You must specify either a to_ids list or the chat_group_id for an existing chat group.If you already know the id of a chat group, you can use it to specify which chat group this message should go to. For details please visit this [link](https://docs.appcelerator.com/arrowdb/latest/#!/api/Chats-method-create). Hope this helps. Thanks
  4. Emmanuel Francis 2018-04-29

    You are correct and I did passed the to_ids = ids.join(','), I forgot to mentioned in this ticket. Below is what I passed { message: message, to_ids:ids.join(','), custom_field: { "[CUSTOM_chatrooms]chatroom_id":3343 } };
  5. Emmanuel Francis 2018-04-29

    Here is my full code sample. Please notice the response, chat is created but when I tried to fetch chat group it does not return any record. var Cloud = require('ti.cloud'); var ids = ["5ae4a04500c731a3","5ae424ee48c54b8b"]; Cloud.Chats.create({ to_ids: ids.join(','), message: 'Good morning', custom_field:{ "[CUSTOM_groups]group_id":"abc" } }, function (e) { if(e.success){ Ti.API.info("chat "+ JSON.stringify(e)); // Response 1 Cloud.Chats.getChatGroups({ response_json_depth:2, where: { "[CUSTOM_groups]group_id":"abc" } },function (eg) { Ti.API.info("chat group "+ JSON.stringify(eg)); // Response 2 }); } }); Response 1: {"chats":[{"id":"5ae584378ab","created_at":"2018-04-29T06:06:52+0000"..... // Response 2 chat group {"chat_groups":[],"success":true,"error":false,"meta":{"code":200,"status":"ok","method_name":"getChatGroups"}} NOTE: I have replaced the ids with dummy value above.
  6. Mostafizur Rahman 2018-05-07

    Hello [~efrancis], Can you please run the the sample code from [here](https://docs.appcelerator.com/arrowdb/latest/#!/api/Chats-method-get_chat_groups) and let us know how it goes.
  7. Emmanuel Francis 2018-05-07

    The sample code you are referring to or in the documentation does not have where clause. Could you please try my sample above and let me know your result?
  8. Mostafizur Rahman 2018-05-14

    Hello [~efrancis], Thanks for your feedback. We are unable to reproduce the issue on our end. Can you please attach a sample test project to reproduce the issue on our end?

JSON Source