Open itsArfinn opened 11 months ago
Hi, @itsArfinn
It is an uncommon thing. Usually, we need to know the amount of unread messages for each dialog. The "want to get the count of message received and send by user" sounds a little strange because it is not clear why this is necessary.
For messages, you should retrieve all dialogs and then all messages for each dialog. Those requests to API have a pagination limit - 100 dialog/messagesю. This can cause a lot of requests at one time.
The calls isn't a server implementation. It is WebRTC API. So, it doesn't store history in the server DB. To make the calls history I recommend using the Custom objects API (https://developers.connectycube.com/server/custom_objects?id=custom-objects-api). You can create records depending on call's event and then read them and count the "outgoing and received calls". Then get records and filter to count. For example, after the class (e.g. "CallsHistory") with fields have a prepared scheme:
const CustomObjectClassName = "CallsHistory";
const createData = {
from: 100001, // user ID
to: 100002, // user ID
media: 'video', // video/audio
duration: 42, // seconds
type: 'missed' // incoming/outgoing/missed/no_answer, etc.
};
const filters = ...
const updateData = ...
const deleteData = ...
const createResult = await ConnectyCube.data.create(CustomObjectClassName, createData);
const listResult = await ConnectyCube.data.list(CustomObjectClassName, filters);
const updateResult = await ConnectyCube.data.update(CustomObjectClassName, updateData);
const deleteResult = await ConnectyCube.data.delete(CustomObjectClassName, deleteData);
Hi, i just want to get the count of message received and send by user, and also outgoing and received calls