Chats in SDKs
Get Users Conversations
This function will return all conversations which the user subscribed before.
- Unity3D
var conversations = ServiceHub.Services.Chats.GetSubscribedConversations(new GetSubscribedConversationsParams
{
Skip = 0,
Limit = 25
});
Get Conversation Members
This function will return all members of a specific conversation.
- Unity3D
var members = await ServiceHub.Services.Chats.GetConversationMembers(new GetConversationMembersParams
{
ConversationId = ConversationId,
Skip = 0,
Limit = 25
})
Get Conversation Messages
This function return last messages of a conversation.
- Unity3D
var messages = ServiceHub.Services.Chats.GetConversationMessages(new GetConversationMessagesParams
{
ConversationId = 0,
Skip = 0,
Limit = 25
});
Subscribe To Conversation
This functions will subscribe user to a new group, you can create or join by specifying group details. If you provide a conversation ID it will join user to it, otherwise it will create a new one.
- Unity3D
await ServiceHub.Services.Chats.Subscribe(new SubscribeParams
{
ConversationId = ConversationId,
ConversationName = "name of new group"
});
Unsubscribe From Conversation
This function will unsubscribe a user from a specific group by ID.
- Unity3D
await ServiceHub.Services.Chats.Unsubscribe(new UnsubscribeParams
{
ConversationId = ConversationId
});
Send
This function will use for sending message to someone or a group, you can specify sending type in ConversationType.Private
or ConversationType.Group
and depends on it, target ID can be group's ID or a user ID.
- Unity3D
await ServiceHub.Services.Chats.Send(new SendParams
{
Type = ConversationType.Private,
TargetUserId = 0,
Message = new Message
{
Type = 0,
Image = null,
Text = null,
Payload = null,
Buttons = null,
Like = 0,
Version = 0
}
});
Edit a Message
This function will edit an existing message.
- Unity3D
await ServiceHub.Services.Chats.EditMessage(new EditMessageParams
{
ConversationId = 0,
MessageId = 0,
Message = new Message
{
Image = null,
Text = null,
Payload = null,
Buttons = null,
Like = 0,
Version = 0
}
});
Delete a Message
This function will delete an existing message.
- Unity3D
await ServiceHub.Services.Chats.DeleteMessage(new DeleteMessageParams
{
ConversationId = 0,
MessageId = 0
});
Delete All Message of a User
This function will delete all messages in a specific group.
- Unity3D
await ServiceHub.Services.Chats.DeleteMessage(new DeleteMessageParams
{
ConversationId = 0,
MessageId = 0
});