/ SDKs / Unity
SDKs
Chat SDKs Unity v4
Chat SDKs Unity
Chat SDKs
Unity
Version 4

Categorize messages by custom type

Copy link

When sending a message, you can specify a custom message type to subclassify messages. This custom type takes on the form of string and can be useful in searching or filtering messages.

The Data and CustomType properties of a message object allow you to append information to your messages. While both properties can be used flexibly, common examples for CustomType include grouping messages into categories such as Notes or Contacts.

To embed a custom type into your message, assign a value to CustomType under the SbUserMessageCreateParams or SbFileMessageCreateParams object. Then, pass the specified object as an argument to the parameter in the SendUserMessage() or SendFileMessage() method.

To get a message's custom type, read message.CustomType.

SbUserMessageCreateParams createParams = new SbUserMessageCreateParams
{
    Message = TEXT_MESSAGE,
    CustomType = CUSTOM_TYPE
};

channel.SendUserMessage(createParams, (inMessage, inError) =>
{
    if (inError != null)
    {
        return; // Handle error.
    }
});