Message Metadata in iOS

Build out your message-specific metadata in iOS with Brand Messenger Legacy

Message metadata is a great way to convey information pertinent to the conversation. This information is forever tied to the message as it is sent, acting as a snapshot of details that can help the Agent and/or administrator.

Adding message metadata in iOS is a two-step process. Messages need to be pulled aside and the metadata added to the message before passing it along to Khoros Response. Here are the steps involved:

  1. Set the conversation's delegate (KBMConversationDelegate)
    • In this example, it's set to the class that opens the messages screen, after show() is called.
  2. Override the willSendMessage function in the delegate file.
- This will intercept the message before it is sent, so developers can add a metadata dictionary into the message object.
-(void)startSecureMessaging:(UIButton*)sender {
    [BrandMessenger show];
    [[BrandMessenger conversation] setDelegate:self];
-(KBMMessage *)conversation:(KBMConversation*)conversation willSendMessage:(KBMMessage *)message {
    [message setMetadata:@{ @"MetadataOS": @"iOS", @"FieldTwo": @"Test" }];
    return message;
func startSecureMessagging(_ sender: UIButton) {
    BrandMessenger.conversation()?.delegate = self
func conversation(_ conversation: KBMConversation, willSend message: KBMMessage) -> KBMMessage {
    message.metadata = ["MetadataOS": "iOS", "FieldTwo":"Test"]
    return message
  1. In the Agent's Admin page, in Developer -> Metadata Visibility, add the Brand Messenger network in the Display Fields in Post section.

This will show the default fields like clients[0].platform. You'll need to add your custom fields. This makes them visible under each message in the conversation under the Metadata section in Khoros Response Agent View.